Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Module Creation

by lhoward (Vicar)
on Jul 17, 2001 at 22:09 UTC ( #97394=note: print w/replies, xml ) Need Help??


in reply to Module Creation

One word of advice on creating your own modules: Use h2xs to generate your module. It builds all the necessary bits (Makefile.PL, POD stub, etc..) and makes it easy to bundle the module for redistribution and testing cpan style...
$ h2xs -A -X -n Example::Plugh Writing Example/Plugh/Plugh.pm Writing Example/Plugh/Makefile.PL Writing Example/Plugh/test.pl Writing Example/Plugh/Changes Writing Example/Plugh/MANIFEST
After h2xs has built the boilerplate, just fill in all your code and you're ready to go.

Replies are listed 'Best First'.
Re: Re: Module Creation
by dragonchild (Archbishop) on Jul 17, 2001 at 22:19 UTC
    This isn't for building modules, this is for building distributables. Building standard modules doesn't need 90% of what h2xs does. (It's all really good stuff, but completely unnecessary.)

      Tom Christianson and/or Nathan Torkington seem to think this is a good idea, as they advocate this technique in the Perl Cookbook. I haven't tried it, but it looks like it takes care of a bunch of boring crap automagically (creating directories and a module skeleton along with other stuff). The syntax they recommend is: h2xs -XA -n Foo
      X suppresses the creation of XS components, the A says that the module won't use the autoloader, and the -n flag marks the name of the module.


      TGI says moo

        My worry is that the "boring crap" very often ends up being either "important crap" or "useless-gets-in-the-way crap". If a module that was solely for internal use and now needs to be distributed in a CPAN-like way, take the time to learn why the MANIFEST (for example) is desirable. The second and subsequent times, use h2xs, by all means.

        I guess I'm old-fashioned. I feel that people should know at least the basics of the tools they're using. *shrugs*

      It may be unnecessary, but sure is handy to have in case you ever start distributing that module that was "just for internal use"... And it doesn't hurt to have the extra stuff that h2xs adds.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://97394]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2019-08-26 08:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?