Code Comments
Programming Forum and web based access to our favorite programming groups.I'm trying to follow the example Larry Wall's "Programming Perl" book and it
is not working with ActiveState 5.8+.
Here is sample.pm:
package sample;
require Exporter;
our @ISA = ("Exporter");
our @EXPORT qw($convex_pl);
$convex_pl = "/cgi-shl/convex.pl";
1;
Here is test_sample_module.pl in the same directory:
use sample;
print $convex_pl;
I get a syntax error:
syntax error at sample.pm line 4, near "@EXPORT qw($convex_pl)"
Compilation failed in require at test_sample_module.pl line 1.
BEGIN failed--compilation aborted at test_sample_module.pl line 1.
Post Follow-up to this message....
>
> our @EXPORT qw($convex_pl);
This is supposed to be a list to array assignment, except that the
assignment operator "=" is missing. Try:
our @EXPORT = qw($convex_pl);
...
> syntax error at sample.pm line 4, near "@EXPORT qw($convex_pl)"
This message tells you there was a syntax error, which means
the code you have is not valid perl. The line number, and what it says
it is near helps pinpoint the problem.
> Compilation failed in require at test_sample_module.pl line 1.
This message tells you your script couldn't compile because the
module failed to load.
> BEGIN failed--compilation aborted at test_sample_module.pl line 1.
This message tells you the BEGIN block failed. That is because
"use" is shorthand for:
BEGIN { require Module; import Module LIST; }
Hopefully, by carefully examining the error message you can avoid
having to ask. Perhaps the example had a misprint.
Jonathan Paton
--
#!perl
$J=' 'x25 ;for (qq< 1+10 9+14 5-10 50-9 7+13 2-18 6+13
17+6 02+1 2-10 00+4 00+8 3-13 3+12 01-5 2-10 01+1 03+4
00+4 00+8 1-21 01+1 00+5 01-7 >=~/ \S\S \S\S /gx) {m/(
\d+) (.+) /x,, vec$ J,$p +=$2 ,8,= $c+= +$1} warn $J,,
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.