패키지 심볼을 네임 스페이스로 내보내는 방법을 이해하는 데 문제가 있습니다. 나는 문서를 거의 동일하게 따라 갔지만 수출 기호에 대해서는 알지 못합니다.패키지 기호를 Perl의 네임 스페이스로 내보내려면 어떻게해야합니까?
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
아주 오래된 Perl. 가능한 경우 업그레이드하십시오. – tsee
레거시 시스템, 난 그걸로 붙어있어 – Mike
아래 답변의 짧은 버전은 이미 TFM에서 설명되어 있습니다 : http://p3rl.org/Exporter#Good_Practices – daxim