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




Quoth "Ronny" <ro.naldfi.scher@xxxxxxxxx>:

Ben Morrow schrieb:

Quoth "Ronny" <ro.naldfi.scher@xxxxxxxxx>:
Ferry Bolhar schrieb:
"Did not find leading dereferencer":
"extract_variable" was expecting one of '$', '@', or '%' at the
start of a variable, but didn't find any of them.
This doesn't make any sense. First, I don't include in my programs any
Text:: stuff. Second, this would not explain why the error message
changes to the real one, if, say, I remove one comment line from the
source code.

Are you by any chance using any modules that set up source filters?
Switch.pm, perhaps? These often use Text::Balanced to do their work, and
it isn't quite as good at parsing Perl as it might be.

Indeed I do have a

use Switch 'Perl6';

in this module. Good point.

Hmmm. You presumably don't want to rewrite your code not to use Switch;
that would be my recommendation. Switch has a number of known bugs, and
is deprecated in favour of the real given/when statements in the
upcoming 5.10; for instance, with the current perl development version:

~/src/perl% cat switch
use feature qw/switch say/;

my $foo = shift;

given ($foo) {
when (/a+/) { say "A"; }
when (2) { say "TWO"; }
default { say "something else"; }
}
~/src/perl% ./bleadperl/perl -I./bleadperl/lib switch aaa
A
~/src/perl% ./bleadperl/perl -I./bleadperl/lib switch 2
TWO
~/src/perl% ./bleadperl/perl -I./bleadperl/lib switch foo
something else

But I would hardly recommend using bleadperl, or even one of the 5.9.x
releases, for production work, either.

As usual, if you reduce your script to the *minimal* example which
reproduces the problem (yes, in this case this might be a lot of work),
and post it here, I'm sure someone can tell you what's going on.

The problem with errors which occur only in "sufficiently big" source
files is that the minimal example is still fairly big. In my case, I
have reduced it to the extent that deleting one single character (for
example, the "#" in front of an empty comment line) already makes this
error go away. Still, the source file is around 350 lines big.

If the error really only occurs with large source files, then the
obvious workaround is to split your module into two.

Ben

--
Heracles: Vulture! Here's a titbit for you / A few dried molecules of the gall
From the liver of a friend of yours. / Excuse the arrow but I have no spoon.
(Ted Hughes, [ Heracles shoots Vulture with arrow. Vulture bursts into ]
'Alcestis') [ flame, and falls out of sight. ] benmorrow@xxxxxxxxxxxxx
.



Relevant Pages

  • Re: use of unassigned local variable
    ... The issue is the compiler doesn't know whether any of the cases will have resulted in the creation of a Foo to assign to teh reference so it is uninitialized as far as the compiler is concerned. ... I am instantiating a class in a switch statement as there are a number ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: "Did not find leading dereferencer" - new findings to an old puzzle
    ... Ben Morrow schrieb: ... You presumably don't want to rewrite your code not to use Switch; ... the source file is around 350 lines big. ... POD documentation alone can easily approach 350 lines. ...
    (comp.lang.perl.misc)
  • Re: why is this happening ?
    ... Some consider it a wart on Tcl since you have to think long and hard to understand it's advantages. ... switch $foo { ... Because inside the switch, ...
    (comp.lang.tcl)
  • Re: [PHP] switch vs elseif
    ... tedd wrote: ... one may not notice immediately the missing break statement. ... switch($foo) ...
    (php.general)
  • Re: The Big Switch
    ... my switch example may have been a bit to simple. ... 0x01 {puts foo} ... So the switch works if you can be sure to have the string 0x01 in the ... set cmd [lindex $opcodes $index] ...
    (comp.lang.tcl)