Re: "Did not find leading dereferencer" - new findings to an old puzzle



On 2006-11-13 12:37, Ronny <ro.naldfi.scher@xxxxxxxxx> wrote:
Peter J. Holzer schrieb:
The use Switch was in the code only for historic reason, and I have
removed it. I don't know of course if *this* was sufficient to make
the error go away: After all, the removal of the statement made the
code a little bit smaller, so the problem might simply have
disappeared for *this* reason (removing a comment line instead of the
use Switch would have had the same effect).

Possible, but unlikely. Unless you use another module which uses
Text::Balanced, you aren't calling Text::Balanced any more and hence
can't get any error messages from it any more.

Well, you are free to get a copy of my code to see what I'm using.
Aside from the Switch, I'm using:

use Carp qw(croak cluck confess);
use File::Temp qw(mktemp);
use File::Basename;

I have no idea whether these modules use Text::Balanced, but note that
even
when I do a "use Switch", I never actually *write* a switch statement.

That's irrelevant. The Switch module can't know whether you use a switch
statement or not not before it has parsed your code.


Then I have the impression that the error message "comes from the
Switch module and goes away when I remove it". I think this does not
describe the situation.

Yes it does. Without the Switch module you get a different error
message. At least that was the way you described it. Did you ever get
this error message without the Switch module?

If you can explain this behaviour just by the fact that I have a "use
Switch" at the beginning, without ever using a switch, I am curious to
know how you do it...

I already did (and (I think) Michele did, too), but I'll try again:

Switch is a source-filter: It parses the file it is "use"d in, replacing
switch and case constructs with Perl code. In an ideal world, it would
understand exactly the same grammar as perl, plus the two (or more)
productions it wants to add to the language. But Perl is a notoriously
complex language to parse, so Switch takes a few shortcuts. This
prevents a few valid Perl constructs and it also causes weird error
messages. A few of these wierd errors are noted in the manual.


I don't think it has anything to do with the size. The problem was
probably that the Switch module needs to parse the source code and that
uses a different grammar than perl (which is unavoidable, as the purpose
of Switch is to change the grammar). So changing a character which
shouldn't make a difference in Perl does make a difference in
Perl+Switch.

I've had a look at Switch.pm .... this module doesn't even have a BEGIN
section.

It uses Filter::Util::Call.

Now I don't pretend to understand how Filter::Util::Call works, but that
is the source filter base class, so I feel confident in stating that
Switch is source filter, too.

In addition, I would like to point out that I had the same error
message a few months ago in a different context.

Yes, I've remember the thread. You were directed towards Text::Balanced
by somebody at the time, but you ignored that advice.

hp

--
_ | Peter J. Holzer | > Wieso sollte man etwas erfinden was nicht
|_|_) | Sysadmin WSR | > ist?
| | | hjp@xxxxxx | Was sonst wäre der Sinn des Erfindens?
__/ | http://www.hjp.at/ | -- P. Einstein u. V. Gringmuth in desd
.



Relevant Pages

  • RE: Cluster in IBM Bladecenter HS20
    ... that I can see then is to carry vlans between the two switch modules. ... switch module two. ... >> then you public network). ... Create a VLAN for each cluster. ...
    (microsoft.public.windows.server.clustering)
  • Re: "Did not find leading dereferencer" - new findings to an old puzzle
    ... Ronny wrote in comp.lang.perl.misc: ... can't get any error messages from it any more. ... The Switch module can't know whether you use a switch ...
    (comp.lang.perl.misc)
  • Re: switch statement
    ... >> The Advantage is you get to use the switch statement. ... >> your code will run extraordinarily slow because the Switch module uses a run time ... I wouldn't use a source filter for anything I cared about. ...
    (perl.beginners)
  • Performance implications of using the Switch module
    ... I hate looking at rows and rows of elsif statements as much as the ... but using the Switch module just doesn't cut it. ... sub use_switch{ ...
    (comp.lang.perl.misc)
  • FAQ 7.22 How do I create a switch or case statement?
    ... If one wants to use pure Perl and to be compatible with Perl versions ... Here's a simple example of a switch based on pattern matching, ... The perlfaq-workers, a group of volunteers, maintain the perlfaq. ... operating system or platform, so please include relevant details for ...
    (comp.lang.perl.misc)