When compiling this code with Perl version 5.8.8:
it gives me an error:$ cat Prueba3.pm BEGIN { unless (Parse::Eyapp::Driver->can('YYParse')) { eval q{ package Parse::Eyapp::Driver; require 5.006; #sub _DBLoad { 1; }; # End of string containing Parse::Eyapp::Driver }; # Unless Parse::Eyapp::Driver was loaded } ########### End of BEGIN
If I delete the comment there are no errors:$ perl -c Prueba3.pm Missing right curly or square bracket at Prueba3.pm line 16, at end of + line (Might be a runaway multi-line {} string starting on line 3) syntax error at Prueba3.pm line 16, at EOF Prueba3.pm had compilation errors. $ perl -v This is perl, v5.8.8 built for i486-linux-gnu-thread-multi
Can someone help?pl@nereida:/tmp$ diff Prueba3.pm Prueba.pm 9d8 < #sub _DBLoad { pl@nereida:/tmp$ perl -c Prueba.pm Prueba.pm syntax OK
Thanks
Casiano
UPDATE:
I have got the same behavior when using Perl 5.10.0
casiano@beowulf:~$ perl -v This is perl, v5.10.0 built for i486-linux-gnu-thread-multi casiano@beowulf:~$ perl -c Prueba3.pm Missing right curly or square bracket at Prueba3.pm line 16, at end of line (Might be a runaway multi-line {} string starting on li +ne 3) syntax error at Prueba3.pm line 16, at EOF Prueba3.pm had compilation errors. casiano@beowulf:~$ perl -c Prueba.pm Prueba.pm syntax OK casiano@beowulf:~$ cat -n Prueba.pm 1 BEGIN { 2 unless (Parse::Eyapp::Driver->can('YYParse')) { 3 eval q{ 4 5 package Parse::Eyapp::Driver; 6 7 require 5.006; 8 9 10 1; 11 12 13 }; # End of string containing Parse::Eyapp::Driver 14 }; # Unless Parse::Eyapp::Driver was loaded 15 } ########### End of BEGIN casiano@beowulf:~$ cat -n Prueba3.pm 1 BEGIN { 2 unless (Parse::Eyapp::Driver->can('YYParse')) { 3 eval q{ 4 5 package Parse::Eyapp::Driver; 6 7 require 5.006; 8 9 #sub _DBLoad { 10 11 1; 12 13 14 }; # End of string containing Parse::Eyapp::Driver 15 }; # Unless Parse::Eyapp::Driver was loaded 16 } ########### End of BEGIN
Of course, the problem can be "solved" by inserting a false "}" inside a comment:
$ perl -c Prueba3trick.pm Prueba3trick.pm syntax OK pl@nereida:/tmp$ cat -n Prueba3trick.pm 1 BEGIN { 2 unless (Parse::Eyapp::Driver->can('YYParse')) { 3 eval q{ 4 5 package Parse::Eyapp::Driver; 6 7 require 5.006; 8 9 #sub _DBLoad { # False curly: } 10 11 1; 12 13 14 }; # End of string 15 }; # Unless Parse::Eyapp::Driver was loaded 16 } ########### End of BEGIN
In reply to Perl 5.8.8 bug? by casiano
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |