我无法理解如何将包符号导出到命名空间.我几乎相同地遵循了文档,但似乎不知道任何导出的符号.
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);
这是运行它的结果
$./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