通常 任何未导出的仍旧可以从外部模块访问 使用YourModule::item_name
[gxp@node2 gaps]$ pwd
/home/gxp/lib/tlcb/gaps
[gxp@node2 gaps]$ cat gxpxml.pm
package tlcb::gasp::gxpxml;
our $var1='asasfdasf';
sub fun1{
return '88888999'
};
1;
[gxp@node2 ~]$ perl test.pl
Can't locate tlcb/gasp/gxpxml.pm in @INC (you may need to install the tlcb::gasp::gxpxml module) (@INC contains: /usr/local/perl/lib/site_perl/5.22.1/x86_64-linux /usr/local/perl/lib/site_perl/5.22.1 /usr/local/perl/lib/5.22.1/x86_64-linux /usr/local/perl/lib/5.22.1 .) at test.pl line 1.
BEGIN failed--compilation aborted at test.pl line 1.
[gxp@node2 ~]$ cat test.pl
use tlcb::gasp::gxpxml;
[gxp@node2 ~]$ perl test.pl
Can't locate tlcb/gasp/gxpxml.pm in @INC (you may need to install the tlcb::gasp::gxpxml module) (@INC contains: /usr/local/perl/lib/site_perl/5.22.1/x86_64-linux /usr/local/perl/lib/site_perl/5.22.1 /usr/local/perl/lib/5.22.1/x86_64-linux /usr/local/perl/lib/5.22.1 .) at test.pl line 1.
BEGIN failed--compilation aborted at test.pl line 1.
[gxp@node2 ~]$ cat test.pl
BEGIN{unshift(@INC,"/home/gxp/lib");};
use tlcb::gaps::gxpxml;
print $tlcb::gaps::gxpxml::var1;
print "
";
print &tlcb::gaps::gxpxml::fun1;
print "
";
[gxp@node2 ~