santoshprasad has asked for the wisdom of the Perl Monks concerning the following question:
Hello Everyone, I am new to perl as well as to this community. I use eclipse editor to write perl script. I have idea, how a module can be written in OO way and how to use it but i am facing challenges when i am writting the same module and want to use Exporter module to import functions.While execution I get error "Can't continue after import errors in eclipse editor but it get executed. If you try same script to execute at windows command prompt then it throws error."
#Test.pm package Test; use strict; use Exporter; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); $VERSION = 1.00; @ISA = qw(Exporter); @EXPORT = (); @EXPORT_OK = qw(func1 func2); %EXPORT_TAGS = ( DEFAULT => [qw(&func1)], Both => [qw(&func1 &func2)]); sub func1 { return reverse @_ } sub func2 { return map{ uc }@_ } 1;
Thank you!#Test.pl use strict; use warnings; # you may need to set @INC here (see below) my @list = qw (J u s t ~ A n o t h e r ~ P e r l ~ H a c k e r !); # case 1 use Test; print func1(@list),"\n"; print func2(@list),"\n"; # case 2 use Test qw(&func1); print func1(@list),"\n"; print Test::func2(@list),"\n"; # case 3 use Test qw(:DEFAULT); print func1(@list),"\n"; print func2(@list),"\n"; # case 4 use Test qw(:Both); print func1(@list),"\n"; print func2(@list),"\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Can't continue after import errors
by toolic (Bishop) on Jun 12, 2015 at 19:45 UTC | |
|
Re: Can't continue after import errors
by marinersk (Priest) on Jun 12, 2015 at 19:42 UTC | |
|
Re: Can't continue after import errors
by AnomalousMonk (Archbishop) on Jun 12, 2015 at 21:27 UTC | |
by santoshprasad (Novice) on Jun 14, 2015 at 11:33 UTC |