in reply to Re: how to write a module
in thread how to write a module
could it be because i'm on win32, or i'm just too tiered to see the obvious?use strict; # 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 MyModule; print func1(@list),"\n"; print func2(@list),"\n"; # case 2 # use MyModule qw(&func1); # print func1(@list),"\n"; # print MyModule::func2(@list),"\n"; # case 3 # use MyModule qw(:DEFAULT); # print func1(@list),"\n"; # print func2(@list),"\n"; # case 4 # use MyModule qw(:Both); # print func1(@list),"\n"; # print func2(@list),"\n"; ------------------------------------- package MyModule; 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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: how to write a module
by pc88mxer (Vicar) on Jun 13, 2008 at 19:11 UTC | |
|
Re^3: how to write a module
by toolic (Bishop) on Jun 13, 2008 at 19:21 UTC |