Perl, module export symbol

Posted by Mike on Stack Overflow See other posts from Stack Overflow or by Mike
Published on 2010-05-26T13:01:37Z Indexed on 2010/05/26 13:11 UTC
Read the original article Hit count: 437

Filed under:
|
|

I'm having trouble understanding how to export a package symbol to a namespace. I've followed the documentation almost identically, but it seems to not know about any of the exporting symbols.

mod.pm

#!/usr/bin/perl

package mod;

use strict;
use warnings;

require Exporter;

@ISA = qw(Exporter);
@EXPORT=qw($a);


our $a=(1);

1;

test.pl

$ cat test.pl
#!/usr/bin/perl

use mod;

print($a);

This is the result of running it

$ ./test.pl
Global symbol "@ISA" requires explicit package name at mod.pm line 10.
Global symbol "@EXPORT" requires explicit package name at mod.pm line 11.
Compilation failed in require at ./test.pl line 3.
BEGIN failed--compilation aborted at ./test.pl line 3.

$ perl -version
This is perl, v5.8.4 built for sun4-solaris-64int

© Stack Overflow or respective owner

Related posts about perl

Related posts about module