summaryrefslogtreecommitdiff
path: root/pod/perlmod.pod
diff options
context:
space:
mode:
Diffstat (limited to 'pod/perlmod.pod')
-rw-r--r--pod/perlmod.pod190
1 files changed, 128 insertions, 62 deletions
diff --git a/pod/perlmod.pod b/pod/perlmod.pod
index 9b649d6425..3f6c19860a 100644
--- a/pod/perlmod.pod
+++ b/pod/perlmod.pod
@@ -222,17 +222,66 @@ definition and make its semantics available implicitly through method
calls on the class and its objects, without explicit exportation of any
symbols. Or it can do a little of both.
-For example, to start a normal module called Fred, create
-a file called Fred.pm and put this at the start of it:
-
- package Fred;
- use strict;
- use Exporter ();
- use vars qw(@ISA @EXPORT @EXPORT_OK);
- @ISA = qw(Exporter);
- @EXPORT = qw(&func1 &func2);
- @EXPORT_OK = qw($sally @listabob %harry &func3);
- use vars qw($sally @listabob %harry);
+For example, to start a normal module called Some::Module, create
+a file called Some/Module.pm and start with this template:
+
+ package Some::Module; # assumes Some/Module.pm
+
+ use strict;
+
+ BEGIN {
+ use Exporter ();
+ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
+
+ # set the version for version checking
+ $VERSION = 1.00;
+ # if using RCS/CVS, this may be preferred
+ $VERSION = do { my @r = (q$Revision: 2.21 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker
+
+ @ISA = qw(Exporter);
+ @EXPORT = qw(&func1 &func2 &func4);
+ %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
+
+ # your exported package globals go here,
+ # as well as any optionally exported functions
+ @EXPORT_OK = qw($Var1 %Hashit &func3);
+ }
+ use vars @EXPORT_OK;
+
+ # non-exported package globals go here
+ use vars qw(@more $stuff);
+
+ # initalize package globals, first exported ones
+ $Var1 = '';
+ %Hashit = ();
+
+ # then the others (which are still accessible as $Some::Module::stuff)
+ $stuff = '';
+ @more = ();
+
+ # all file-scoped lexicals must be created before
+ # the functions below that use them.
+
+ # file-private lexicals go here
+ my $priv_var = '';
+ my %secret_hash = ();
+
+ # here's a file-private function as a closure,
+ # callable as &$priv_func; it cannot be prototyped.
+ my $priv_func = sub {
+ # stuff goes here.
+ };
+
+ # make all your functions, whether exported or not;
+ # remember to put something interesting in the {} stubs
+ sub func1 {} # no prototype
+ sub func2() {} # proto'd void
+ sub func3($$) {} # proto'd to 2 scalars
+
+ # this one isn't exported, but could be called!
+ sub func4(\%) {} # proto'd to 1 hash ref
+
+ END { } # module clean-up code here (global destructor)
Then go on to declare and use your variables in functions
without any qualifications.
@@ -904,70 +953,87 @@ You should try to choose one close to you:
=over
=item *
-ftp://ftp.sterling.com/programming/languages/perl/
-
-=item *
-ftp://ftp.sedl.org/pub/mirrors/CPAN/
-
-=item *
-ftp://ftp.uoknor.edu/mirrors/CPAN/
-
-=item *
-ftp://ftp.delphi.com/pub/mirrors/packages/perl/CPAN/
+Africa
-=item *
-ftp://uiarchive.cso.uiuc.edu/pub/lang/perl/CPAN/
-
-=item *
-ftp://ftp.cis.ufl.edu/pub/perl/CPAN/
-
-=item *
-ftp://ftp.switch.ch/mirror/CPAN/
-
-=item *
-ftp://ftp.sunet.se/pub/lang/perl/CPAN/
-
-=item *
-ftp://ftp.ci.uminho.pt/pub/lang/perl/
-
-=item *
-ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
+ South Africa ftp://ftp.is.co.za/programming/perl/CPAN/
=item *
-ftp://ftp.demon.co.uk/pub/mirrors/perl/CPAN/
+Asia
-=item *
-ftp://ftp.rz.ruhr-uni-bochum.de/pub/programming/languages/perl/CPAN/
-
-=item *
-ftp://ftp.leo.org/pub/comp/programming/languages/perl/CPAN/
+ Hong Kong ftp://ftp.hkstar.com/pub/CPAN/
+ Japan ftp://ftp.jaist.ac.jp/pub/lang/perl/CPAN/
+ ftp://ftp.lab.kdd.co.jp/lang/perl/CPAN/
+ South Korea ftp://ftp.nuri.net/pub/CPAN/
+ Taiwan ftp://dongpo.math.ncu.edu.tw/perl/CPAN/
+ ftp://ftp.wownet.net/pub2/PERL/
=item *
-ftp://ftp.pasteur.fr/pub/computing/unix/perl/CPAN/
+Australasia
-=item *
-ftp://ftp.ibp.fr/pub/perl/CPAN/
-
-=item *
-ftp://ftp.funet.fi/pub/languages/perl/CPAN/
+ Australia ftp://ftp.netinfo.com.au/pub/perl/CPAN/
+ New Zealand ftp://ftp.tekotago.ac.nz/pub/perl/CPAN/
=item *
-ftp://ftp.tekotago.ac.nz/pub/perl/CPAN/
+Europe
+
+ Austria ftp://ftp.tuwien.ac.at/pub/languages/perl/CPAN/
+ Belgium ftp://ftp.kulnet.kuleuven.ac.be/pub/mirror/CPAN/
+ Czech Republic ftp://sunsite.mff.cuni.cz/Languages/Perl/CPAN/
+ Denmark ftp://sunsite.auc.dk/pub/languages/perl/CPAN/
+ Finland ftp://ftp.funet.fi/pub/languages/perl/CPAN/
+ France ftp://ftp.ibp.fr/pub/perl/CPAN/
+ ftp://ftp.pasteur.fr/pub/computing/unix/perl/CPAN/
+ Germany ftp://ftp.gmd.de/packages/CPAN/
+ ftp://ftp.leo.org/pub/comp/programming/languages/perl/CPAN/
+ ftp://ftp.mpi-sb.mpg.de/pub/perl/CPAN/
+ ftp://ftp.rz.ruhr-uni-bochum.de/pub/CPAN/
+ ftp://ftp.uni-erlangen.de/pub/source/Perl/CPAN/
+ ftp://ftp.uni-hamburg.de/pub/soft/lang/perl/CPAN/
+ Greece ftp://ftp.ntua.gr/pub/lang/perl/
+ Hungary ftp://ftp.kfki.hu/pub/packages/perl/CPAN/
+ Italy ftp://cis.utovrm.it/CPAN/
+ the Netherlands ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
+ ftp://ftp.EU.net/packages/cpan/
+ Norway ftp://ftp.uit.no/pub/languages/perl/cpan/
+ Poland ftp://ftp.pk.edu.pl/pub/lang/perl/CPAN/
+ ftp://sunsite.icm.edu.pl/pub/CPAN/
+ Portugal ftp://ftp.ci.uminho.pt/pub/lang/perl/
+ ftp://ftp.telepac.pt/pub/CPAN/
+ Russia ftp://ftp.sai.msu.su/pub/lang/perl/CPAN/
+ Slovenia ftp://ftp.arnes.si/software/perl/CPAN/
+ Spain ftp://ftp.etse.urv.es/pub/mirror/perl/
+ ftp://ftp.rediris.es/mirror/CPAN/
+ Sweden ftp://ftp.sunet.se/pub/lang/perl/CPAN/
+ Switzerland ftp://sunsite.cnlab-switch.ch/mirror/CPAN/
+ UK ftp://ftp.demon.co.uk/pub/mirrors/perl/CPAN/
+ ftp://sunsite.doc.ic.ac.uk/packages/CPAN/
+ ftp://unix.hensa.ac.uk/mirrors/perl-CPAN/
=item *
-ftp://ftp.mame.mu.oz.au/pub/perl/CPAN/
+North America
+
+ Ontario ftp://ftp.utilis.com/public/CPAN/
+ ftp://enterprise.ic.gc.ca/pub/perl/CPAN/
+ Manitoba ftp://theory.uwinnipeg.ca/pub/CPAN/
+ California ftp://ftp.digital.com/pub/plan/perl/CPAN/
+ ftp://ftp.cdrom.com/pub/perl/
+ Colorado ftp://ftp.cs.colorado.edu/pub/perl/CPAN/
+ Florida ftp://ftp.cis.ufl.edu/pub/perl/CPAN/
+ Illinois ftp://uiarchive.uiuc.edu/pub/lang/perl/CPAN/
+ Massachusetts ftp://ftp.iguide.com/pub/mirrors/packages/perl/CPAN/
+ New York ftp://ftp.rge.com/pub/languages/perl/
+ North Carolina ftp://ftp.duke.edu/pub/perl/
+ Oklahoma ftp://ftp.ou.edu/mirrors/CPAN/
+ Oregon ftp://ftp.orst.edu/pub/packages/CPAN/
+ Pennsylvania ftp://ftp.epix.net/pub/languages/perl/
+ Texas ftp://ftp.sedl.org/pub/mirrors/CPAN/
+ ftp://ftp.metronet.com/pub/perl/
+ Washington ftp://ftp.spu.edu/pub/CPAN/
=item *
-ftp://coombs.anu.edu.au/pub/perl/
+South America
-=item *
-ftp://dongpo.math.ncu.edu.tw/perl/CPAN/
-
-=item *
-ftp://ftp.lab.kdd.co.jp/lang/perl/CPAN/
-
-=item *
-ftp://ftp.is.co.za/programming/perl/CPAN/
+ Chile ftp://sunsite.dcc.uchile.cl/pub/Lang/perl/CPAN/
=back
@@ -1273,7 +1339,7 @@ or upload to one of these sites:
ftp://franz.ww.tu-berlin.de/incoming
ftp://ftp.cis.ufl.edu/incoming
-and notify upload@franz.ww.tu-berlin.de.
+and notify <F<upload@franz.ww.tu-berlin.de>>.
By using the WWW interface you can ask the Upload Server to mirror
your modules from your ftp or WWW site into your own directory on