golden hour
/usr/share/perl5/pod
⬆️ Go Up
Upload
File/Folder
Size
Actions
perl.pod
16.28 KB
Del
OK
perl5004delta.pod
54.92 KB
Del
OK
perl5005delta.pod
33.48 KB
Del
OK
perl5100delta.pod
54.23 KB
Del
OK
perl5101delta.pod
42.86 KB
Del
OK
perl5120delta.pod
87.18 KB
Del
OK
perl5121delta.pod
9.9 KB
Del
OK
perl5122delta.pod
9.38 KB
Del
OK
perl5123delta.pod
4 KB
Del
OK
perl5124delta.pod
3.59 KB
Del
OK
perl5125delta.pod
7.5 KB
Del
OK
perl5140delta.pod
140.94 KB
Del
OK
perl5141delta.pod
7.78 KB
Del
OK
perl5142delta.pod
6.73 KB
Del
OK
perl5143delta.pod
7.58 KB
Del
OK
perl5144delta.pod
6.18 KB
Del
OK
perl5160delta.pod
130.52 KB
Del
OK
perl5161delta.pod
6 KB
Del
OK
perl5162delta.pod
3.51 KB
Del
OK
perl5163delta.pod
3.99 KB
Del
OK
perl5180delta.pod
116.63 KB
Del
OK
perl5181delta.pod
6.44 KB
Del
OK
perl5182delta.pod
5.21 KB
Del
OK
perl5184delta.pod
4.53 KB
Del
OK
perl5200delta.pod
112.99 KB
Del
OK
perl5201delta.pod
10.64 KB
Del
OK
perl5202delta.pod
12.22 KB
Del
OK
perl5203delta.pod
9.17 KB
Del
OK
perl5220delta.pod
127.89 KB
Del
OK
perl5221delta.pod
10.51 KB
Del
OK
perl5222delta.pod
12.33 KB
Del
OK
perl5223delta.pod
8.26 KB
Del
OK
perl5224delta.pod
4.36 KB
Del
OK
perl5240delta.pod
63.4 KB
Del
OK
perl5241delta.pod
8.02 KB
Del
OK
perl5242delta.pod
4.02 KB
Del
OK
perl5243delta.pod
11.16 KB
Del
OK
perl5244delta.pod
4.4 KB
Del
OK
perl5260delta.pod
99.45 KB
Del
OK
perl5261delta.pod
7.74 KB
Del
OK
perl5262delta.pod
7.7 KB
Del
OK
perl5263delta.pod
6.9 KB
Del
OK
perl5280delta.pod
70.42 KB
Del
OK
perl5281delta.pod
4.53 KB
Del
OK
perl5282delta.pod
6.05 KB
Del
OK
perl5283delta.pod
4.99 KB
Del
OK
perl5300delta.pod
40.31 KB
Del
OK
perl5301delta.pod
5.6 KB
Del
OK
perl5302delta.pod
4.57 KB
Del
OK
perl5303delta.pod
4.86 KB
Del
OK
perl5320delta.pod
53.32 KB
Del
OK
perl5321delta.pod
6.84 KB
Del
OK
perl561delta.pod
121.79 KB
Del
OK
perl56delta.pod
104.69 KB
Del
OK
perl581delta.pod
37.17 KB
Del
OK
perl582delta.pod
4.37 KB
Del
OK
perl583delta.pod
6.19 KB
Del
OK
perl584delta.pod
7.19 KB
Del
OK
perl585delta.pod
5.75 KB
Del
OK
perl586delta.pod
4.54 KB
Del
OK
perl587delta.pod
8.16 KB
Del
OK
perl588delta.pod
24.69 KB
Del
OK
perl589delta.pod
52.64 KB
Del
OK
perl58delta.pod
112.47 KB
Del
OK
perlaix.pod
19.96 KB
Del
OK
perlamiga.pod
5.61 KB
Del
OK
perlandroid.pod
8.03 KB
Del
OK
perlapi.pod
481.55 KB
Del
OK
perlapio.pod
20.84 KB
Del
OK
perlartistic.pod
6.85 KB
Del
OK
perlbook.pod
8.19 KB
Del
OK
perlboot.pod
294 B
Del
OK
perlbot.pod
304 B
Del
OK
perlbs2000.pod
7.81 KB
Del
OK
perlcall.pod
55.41 KB
Del
OK
perlcheat.pod
4.38 KB
Del
OK
perlclib.pod
9.38 KB
Del
OK
perlcn.pod
4.65 KB
Del
OK
perlcommunity.pod
6.82 KB
Del
OK
perlcygwin.pod
26.56 KB
Del
OK
perldata.pod
48.62 KB
Del
OK
perldbmfilter.pod
4.86 KB
Del
OK
perldebguts.pod
41.34 KB
Del
OK
perldebtut.pod
21.63 KB
Del
OK
perldebug.pod
38.46 KB
Del
OK
perldelta.pod
6.84 KB
Del
OK
perldeprecation.pod
20.34 KB
Del
OK
perldiag.pod
290.03 KB
Del
OK
perldos.pod
10.28 KB
Del
OK
perldsc.pod
25.01 KB
Del
OK
perldtrace.pod
7.77 KB
Del
OK
perlebcdic.pod
82.37 KB
Del
OK
perlembed.pod
36.69 KB
Del
OK
perlexperiment.pod
7.06 KB
Del
OK
perlfork.pod
13.04 KB
Del
OK
perlform.pod
16.22 KB
Del
OK
perlfreebsd.pod
1.58 KB
Del
OK
perlfunc.pod
394.31 KB
Del
OK
perlgit.pod
28.9 KB
Del
OK
perlgov.pod
14.14 KB
Del
OK
perlgpl.pod
13.49 KB
Del
OK
perlguts.pod
158.3 KB
Del
OK
perlhack.pod
42.15 KB
Del
OK
perlhacktips.pod
56.34 KB
Del
OK
perlhacktut.pod
6.01 KB
Del
OK
perlhaiku.pod
1.47 KB
Del
OK
perlhist.pod
54.85 KB
Del
OK
perlhpux.pod
29.89 KB
Del
OK
perlhurd.pod
1.95 KB
Del
OK
perlintern.pod
81.61 KB
Del
OK
perlinterp.pod
32.92 KB
Del
OK
perlintro.pod
21.62 KB
Del
OK
perliol.pod
33.99 KB
Del
OK
perlipc.pod
69.85 KB
Del
OK
perlirix.pod
4.31 KB
Del
OK
perljp.pod
8.23 KB
Del
OK
perlko.pod
11.92 KB
Del
OK
perllexwarn.pod
355 B
Del
OK
perllinux.pod
1.96 KB
Del
OK
perllocale.pod
72.38 KB
Del
OK
perllol.pod
9.36 KB
Del
OK
perlmacos.pod
998 B
Del
OK
perlmacosx.pod
11.84 KB
Del
OK
perlmod.pod
25.58 KB
Del
OK
perlmodinstall.pod
10.02 KB
Del
OK
perlmodlib.pod
74.56 KB
Del
OK
perlmodstyle.pod
22.06 KB
Del
OK
perlmroapi.pod
3.2 KB
Del
OK
perlnetware.pod
6.49 KB
Del
OK
perlnewmod.pod
10.78 KB
Del
OK
perlnumber.pod
8.16 KB
Del
OK
perlobj.pod
34.88 KB
Del
OK
perlootut.pod
26.13 KB
Del
OK
perlop.pod
145.4 KB
Del
OK
perlopenbsd.pod
1.2 KB
Del
OK
perlopentut.pod
14.87 KB
Del
OK
perlos2.pod
91.16 KB
Del
OK
perlos390.pod
16.14 KB
Del
OK
perlos400.pod
4.65 KB
Del
OK
perlpacktut.pod
50.17 KB
Del
OK
perlperf.pod
48.71 KB
Del
OK
perlplan9.pod
5 KB
Del
OK
perlpod.pod
22.54 KB
Del
OK
perlpodspec.pod
67.02 KB
Del
OK
perlpolicy.pod
25.94 KB
Del
OK
perlport.pod
86.61 KB
Del
OK
perlpragma.pod
5.05 KB
Del
OK
perlqnx.pod
6.52 KB
Del
OK
perlre.pod
127.75 KB
Del
OK
perlreapi.pod
29.54 KB
Del
OK
perlrebackslash.pod
31.53 KB
Del
OK
perlrecharclass.pod
48.54 KB
Del
OK
perlref.pod
34.6 KB
Del
OK
perlreftut.pod
18.38 KB
Del
OK
perlreguts.pod
38.38 KB
Del
OK
perlrepository.pod
509 B
Del
OK
perlrequick.pod
18.69 KB
Del
OK
perlreref.pod
15.22 KB
Del
OK
perlretut.pod
119.66 KB
Del
OK
perlriscos.pod
1.49 KB
Del
OK
perlrun.pod
54.67 KB
Del
OK
perlsec.pod
26.95 KB
Del
OK
perlsecpolicy.pod
18.99 KB
Del
OK
perlsolaris.pod
29.14 KB
Del
OK
perlsource.pod
6.96 KB
Del
OK
perlstyle.pod
8.53 KB
Del
OK
perlsub.pod
72.66 KB
Del
OK
perlsymbian.pod
14.98 KB
Del
OK
perlsyn.pod
44.08 KB
Del
OK
perlsynology.pod
7.77 KB
Del
OK
perlthrtut.pod
45.43 KB
Del
OK
perltie.pod
38.39 KB
Del
OK
perltoc.pod
685.35 KB
Del
OK
perltodo.pod
372 B
Del
OK
perltooc.pod
294 B
Del
OK
perltoot.pod
294 B
Del
OK
perltrap.pod
10.37 KB
Del
OK
perltru64.pod
8.29 KB
Del
OK
perltw.pod
4.36 KB
Del
OK
perlunicode.pod
89.21 KB
Del
OK
perlunicook.pod
25.06 KB
Del
OK
perlunifaq.pod
13.32 KB
Del
OK
perluniintro.pod
37.74 KB
Del
OK
perluniprops.pod
431.26 KB
Del
OK
perlunitut.pod
7.76 KB
Del
OK
perlutil.pod
7.12 KB
Del
OK
perlvar.pod
80.64 KB
Del
OK
perlvms.pod
49.63 KB
Del
OK
perlvos.pod
3.75 KB
Del
OK
perlwin32.pod
39.37 KB
Del
OK
Edit: perlnewmod.pod
=head1 NAME perlnewmod - preparing a new module for distribution =head1 DESCRIPTION This document gives you some suggestions about how to go about writing Perl modules, preparing them for distribution, and making them available via CPAN. One of the things that makes Perl really powerful is the fact that Perl hackers tend to want to share the solutions to problems they've faced, so you and I don't have to battle with the same problem again. The main way they do this is by abstracting the solution into a Perl module. If you don't know what one of these is, the rest of this document isn't going to be much use to you. You're also missing out on an awful lot of useful code; consider having a look at L<perlmod>, L<perlmodlib> and L<perlmodinstall> before coming back here. When you've found that there isn't a module available for what you're trying to do, and you've had to write the code yourself, consider packaging up the solution into a module and uploading it to CPAN so that others can benefit. You should also take a look at L<perlmodstyle> for best practices in making a module. =head2 Warning We're going to primarily concentrate on Perl-only modules here, rather than XS modules. XS modules serve a rather different purpose, and you should consider different things before distributing them - the popularity of the library you are gluing, the portability to other operating systems, and so on. However, the notes on preparing the Perl side of the module and packaging and distributing it will apply equally well to an XS module as a pure-Perl one. =head2 What should I make into a module? You should make a module out of any code that you think is going to be useful to others. Anything that's likely to fill a hole in the communal library and which someone else can slot directly into their program. Any part of your code which you can isolate and extract and plug into something else is a likely candidate. Let's take an example. Suppose you're reading in data from a local format into a hash-of-hashes in Perl, turning that into a tree, walking the tree and then piping each node to an Acme Transmogrifier Server. Now, quite a few people have the Acme Transmogrifier, and you've had to write something to talk the protocol from scratch - you'd almost certainly want to make that into a module. The level at which you pitch it is up to you: you might want protocol-level modules analogous to L<Net::SMTP|Net::SMTP> which then talk to higher level modules analogous to L<Mail::Send|Mail::Send>. The choice is yours, but you do want to get a module out for that server protocol. Nobody else on the planet is going to talk your local data format, so we can ignore that. But what about the thing in the middle? Building tree structures from Perl variables and then traversing them is a nice, general problem, and if nobody's already written a module that does that, you might want to modularise that code too. So hopefully you've now got a few ideas about what's good to modularise. Let's now see how it's done. =head2 Step-by-step: Preparing the ground Before we even start scraping out the code, there are a few things we'll want to do in advance. =over 3 =item Look around Dig into a bunch of modules to see how they're written. I'd suggest starting with L<Text::Tabs|Text::Tabs>, since it's in the standard library and is nice and simple, and then looking at something a little more complex like L<File::Copy|File::Copy>. For object oriented code, L<WWW::Mechanize> or the C<Email::*> modules provide some good examples. These should give you an overall feel for how modules are laid out and written. =item Check it's new There are a lot of modules on CPAN, and it's easy to miss one that's similar to what you're planning on contributing. Have a good plough through L<http://metacpan.org> and make sure you're not the one reinventing the wheel! =item Discuss the need You might love it. You might feel that everyone else needs it. But there might not actually be any real demand for it out there. If you're unsure about the demand your module will have, consider asking the C<module-authors@perl.org> mailing list (send an email to C<module-authors-subscribe@perl.org> to subscribe; see L<https://lists.perl.org/list/module-authors.html> for more information and a link to the archives). =item Choose a name Perl modules included on CPAN have a naming hierarchy you should try to fit in with. See L<perlmodlib> for more details on how this works, and browse around CPAN and the modules list to get a feel of it. At the very least, remember this: modules should be title capitalised, (This::Thing) fit in with a category, and explain their purpose succinctly. =item Check again While you're doing that, make really sure you haven't missed a module similar to the one you're about to write. When you've got your name sorted out and you're sure that your module is wanted and not currently available, it's time to start coding. =back =head2 Step-by-step: Making the module =over 3 =item Start with F<module-starter> or F<h2xs> The F<module-starter> utility is distributed as part of the L<Module::Starter|Module::Starter> CPAN package. It creates a directory with stubs of all the necessary files to start a new module, according to recent "best practice" for module development, and is invoked from the command line, thus: module-starter --module=Foo::Bar \ --author="Your Name" --email=yourname@cpan.org If you do not wish to install the L<Module::Starter|Module::Starter> package from CPAN, F<h2xs> is an older tool, originally intended for the development of XS modules, which comes packaged with the Perl distribution. A typical invocation of L<h2xs|h2xs> for a pure Perl module is: h2xs -AX --skip-exporter --use-new-tests -n Foo::Bar The C<-A> omits the Autoloader code, C<-X> omits XS elements, C<--skip-exporter> omits the Exporter code, C<--use-new-tests> sets up a modern testing environment, and C<-n> specifies the name of the module. =item Use L<strict|strict> and L<warnings|warnings> A module's code has to be warning and strict-clean, since you can't guarantee the conditions that it'll be used under. Besides, you wouldn't want to distribute code that wasn't warning or strict-clean anyway, right? =item Use L<Carp|Carp> The L<Carp|Carp> module allows you to present your error messages from the caller's perspective; this gives you a way to signal a problem with the caller and not your module. For instance, if you say this: warn "No hostname given"; the user will see something like this: No hostname given at /usr/local/lib/perl5/site_perl/5.6.0/Net/Acme.pm line 123. which looks like your module is doing something wrong. Instead, you want to put the blame on the user, and say this: No hostname given at bad_code, line 10. You do this by using L<Carp|Carp> and replacing your C<warn>s with C<carp>s. If you need to C<die>, say C<croak> instead. However, keep C<warn> and C<die> in place for your sanity checks - where it really is your module at fault. =item Use L<Exporter|Exporter> - wisely! L<Exporter|Exporter> gives you a standard way of exporting symbols and subroutines from your module into the caller's namespace. For instance, saying C<use Net::Acme qw(&frob)> would import the C<frob> subroutine. The package variable C<@EXPORT> will determine which symbols will get exported when the caller simply says C<use Net::Acme> - you will hardly ever want to put anything in there. C<@EXPORT_OK>, on the other hand, specifies which symbols you're willing to export. If you do want to export a bunch of symbols, use the C<%EXPORT_TAGS> and define a standard export set - look at L<Exporter> for more details. =item Use L<plain old documentation|perlpod> The work isn't over until the paperwork is done, and you're going to need to put in some time writing some documentation for your module. C<module-starter> or C<h2xs> will provide a stub for you to fill in; if you're not sure about the format, look at L<perlpod> for an introduction. Provide a good synopsis of how your module is used in code, a description, and then notes on the syntax and function of the individual subroutines or methods. Use Perl comments for developer notes and POD for end-user notes. =item Write tests You're encouraged to create self-tests for your module to ensure it's working as intended on the myriad platforms Perl supports; if you upload your module to CPAN, a host of testers will build your module and send you the results of the tests. Again, C<module-starter> and C<h2xs> provide a test framework which you can extend - you should do something more than just checking your module will compile. L<Test::Simple|Test::Simple> and L<Test::More|Test::More> are good places to start when writing a test suite. =item Write the F<README> If you're uploading to CPAN, the automated gremlins will extract the README file and place that in your CPAN directory. It'll also appear in the main F<by-module> and F<by-category> directories if you make it onto the modules list. It's a good idea to put here what the module actually does in detail. =item Write F<Changes> Add any user-visible changes since the last release to your F<Changes> file. =back =head2 Step-by-step: Distributing your module =over 3 =item Get a CPAN user ID Every developer publishing modules on CPAN needs a CPAN ID. Visit C<L<http://pause.perl.org/>>, select "Request PAUSE Account", and wait for your request to be approved by the PAUSE administrators. =item C<perl Makefile.PL; make test; make distcheck; make dist> Once again, C<module-starter> or C<h2xs> has done all the work for you. They produce the standard C<Makefile.PL> you see when you download and install modules, and this produces a Makefile with a C<dist> target. Once you've ensured that your module passes its own tests - always a good thing to make sure - you can C<make distcheck> to make sure everything looks OK, followed by C<make dist>, and the Makefile will hopefully produce you a nice tarball of your module, ready for upload. =item Upload the tarball The email you got when you received your CPAN ID will tell you how to log in to PAUSE, the Perl Authors Upload SErver. From the menus there, you can upload your module to CPAN. Alternatively you can use the F<cpan-upload> script, part of the L<CPAN::Uploader> distribution on CPAN. =item Fix bugs! Once you start accumulating users, they'll send you bug reports. If you're lucky, they'll even send you patches. Welcome to the joys of maintaining a software project... =back =head1 AUTHOR Simon Cozens, C<simon@cpan.org> Updated by Kirrily "Skud" Robert, C<skud@cpan.org> =head1 SEE ALSO L<perlmod>, L<perlmodlib>, L<perlmodinstall>, L<h2xs>, L<strict>, L<Carp>, L<Exporter>, L<perlpod>, L<Test::Simple>, L<Test::More> L<ExtUtils::MakeMaker>, L<Module::Build>, L<Module::Starter> L<http://www.cpan.org/>, Ken Williams' tutorial on building your own module at L<http://mathforum.org/~ken/perl_modules.html>
Save