develooper Front page | perl.perl5.porters | Postings from February 2004

Re: Eval Errors

From:
Randy W. Sims
Date:
February 23, 2004 21:11
Subject:
Re: Eval Errors
Message ID:
403ADC8A.1020703@ThePierianSpring.org
I've CC'd p5p for enlightenment & simplified your code to the following:

my @code = (
   q('a poorly 'nested' string'),
   q('a poorly 'nested::nested' string'),
);

for (@code) {
   eval;
   print "Caught: $@" if $@;
}

Output is:

Caught: Bad name after nested' at (eval 1) line 1.
Bareword found where operator expected at (eval 2) line 1, near "'a 
poorly 'nested::nested"
         (Missing operator before nested::nested?)
String found where operator expected at (eval 2) line 1, near 
"nested::nested' string'"
Caught: syntax error at (eval 2) line 1, near "'a poorly 'nested::nested"

I understand the errors, but not the difference in behaviour. I think 
this is DWIMish bug in perl, but let's see what more enlightened minds 
say before reporting it as such.

Randy.



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About