in reply to Module writing hints?
And here is how it is used:package Foo; require Exporter; @ISA = qw|Exporter|; @EXPORT_OK = qw|foo|; sub foo { print "Hello World\n"; } 1;
Simplicity itself: we mark the routine foo() as exportable and import it with use Foo foo;. The complexity you saw comes if you want to package up your module as a full blown library worthy of CPAN. For that you will want to read perlman:perlmod to see how modules work and perlman:perlmodlib to see how to create them. Also check out perlnewmod for preparing a new module for distribution. -Markuse Foo foo; foo(); print "Goodbye\n";
|
|---|