<pre name="code" class="html"><pre name="code" class="html">[tomcat@wx02 test]$ pwd /home/tomcat/test [tomcat@wx02 test]$ cat Pkg1.pm package Pkg1; sub fun1 {print "aaaaaa ";}; 1; [tomcat@wx02 test]$ cat Pkg2.pm package Pkg2; sub fun2 {print "bbbbbbbb ";}; 1; [tomcat@wx02 test]$ cat Pkg3.pm package Pkg3; sub fun3 {print "ccccccccccccccccc ";}; 1; [tomcat@wx02 test]$ cat scan.pm package scan; use base qw(Pkg1 Pkg2 Pkg3); sub new { my $invocant = shift; my $class = ref($invocant) || $invocant; my $self = { }; bless $self, $class; return $self; }; 1; [tomcat@wx02 test]$ cat a1.pl use scan; $ua=scan->new(); $ua->fun1(); $ua->fun2(); $ua->fun3(); &fun3(); [tomcat@wx02 test]$ perl a1.pl aaaaaa bbbbbbbb ccccccccccccccccc Undefined subroutine &main::fun3 called at a1.pl line 6. /************************************************ [tomcat@wx02 tmp]$ pwd /tmp [tomcat@wx02 tmp]$ cat a1.pl use scan; $ua=scan->new(); $ua->fun1(); $ua->fun2(); $ua->fun3(); &fun3(); [tomcat@wx02 tmp]$ perl a1.pl Can't locate scan.pm in @INC (you may need to install the scan 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 a1.pl line 2. BEGIN failed--compilation aborted at a1.pl line 2. /********************************************** [tomcat@wx02 tmp]$ cat a1.pl use lib '/home/tomcat/test'; use scan; $ua=scan->new(); $ua->fun1(); $ua->fun2(); $ua->fun3(); &fun3(); [tomcat@wx02 tmp]$ perl a1.pl aaaaaa bbbbbbbb ccccccccccccccccc Undefined subroutine &main::fun3 called at a1.pl line 7.