Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

What's your Module Template

by Cody Pendant (Prior)
on Sep 15, 2005 at 06:10 UTC ( #492124=perlquestion: print w/ replies, xml ) Need Help??
Cody Pendant has asked for the wisdom of the Perl Monks concerning the following question:

I'm sure I've read posts about this here before, but it's hard to find "Module Template" when there are so many posts about Template Modules.

In short, if you have a blank .pm document which you use when starting a new module, what's in it? Or do you use a utility like module-maker or ModuleStarter?



($_='kkvvttuu bbooppuuiiffss qqffssmm iibbddllffss')
=~y~b-v~a-z~s; print

Comment on What's your Module Template
Re: What's your Module Template
by jepri (Parson) on Sep 15, 2005 at 06:49 UTC
    I type perldoc perlmod and then cut and paste the example at the end.

    ___________________
    Jeremy
    I didn't believe in evil until I dated it.

Re: What's your Module Template
by borisz (Canon) on Sep 15, 2005 at 06:50 UTC
      Very interesting, I'll give it a try. At the moment I simply start by hand from an empty file, no template at all.
Re: What's your Module Template
by strat (Canon) on Sep 15, 2005 at 07:32 UTC

    I use h2xs -A -X -b 5.5.0 -n Name::Of::Module or something the like.... but Module::Starter looks interesting, thanks for the hint.

    Best regards,
    perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"

Re: What's your Module Template
by DrHyde (Prior) on Sep 15, 2005 at 09:45 UTC
    My template is the previous module I wrote.
Re: What's your Module Template
by polypompholyx (Chaplain) on Sep 15, 2005 at 10:13 UTC

    I use a 'new.pl' script, which is basically just a thin wrapper around ExtUtils::ModuleMaker. I use the same script to generate script boilerplate too, but have to create this from a template, which has GetOpt::Long, --help and the other usual suspects pre-coded. It'd be nice if there were a CPAN module that did for scripts what ExtUtils::ModuleMaker does for modules, but I've yet to find (or I suppose, write) one.

      I've been using ExtUtils::ModuleMaker::TT (which I wrote). It extends ExtUtils::ModuleMaker to use the Template Toolkit skeletons for the files it builds. It should be easy to create a "modulino" template for more script-like skeleton that could be called with a command line config-file option.

      It's been a little fragile lately given the great (and long-overdue) overhaul that jkeenan1 has just given to ExtUtils::ModuleMaker, but I just released a fresh version to CPAN this morning that is compatible with ExtUtils::ModuleMaker 0.39 and I'll be eliminating some code smells in the next couple weeks.

      -xdg

      Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

        Thanks for the tip: I'll give that a go.
Re: What's your Module Template
by castaway (Parson) on Sep 15, 2005 at 11:04 UTC
    I don't have one.

    Thus forcing myself to remember what I'm doing, and not just having a bunch of default code that may or may not be relevant to the module I'm writing.

    What's yours btw?

    C.

      I believe in the third way, although I'm definitely not a New Labour or Tony Blair supporter (except when he annoys the unions and I thought the minute or so I saw of his speech to the UN the other day was rather good).

      I think it's always good to have a little boilerplate, like comments and use strict, maybe constructor templates, etc, because it helps with best practice. But it's bad (I know from experience) to just get an old project (usually in Delphi where I work, although sometimes in Perl too) and just save it under a different name and start writing the stuff that's specific for the new project.

      How can you feel when you're made of steel? I am made of steel. I am the Robot Tourist.
      Robot Tourist, by Ten Benson

Re: What's your Module Template
by Tanktalus (Canon) on Sep 15, 2005 at 15:45 UTC

    My boilerplate is:

    For open-source stuff like goes on CPAN, I don't have a boilerplate. At least, not yet. :-)

Re: What's your Module Template
by TheDamian (Priest) on Sep 16, 2005 at 00:52 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://492124]
Approved by greenFox
Front-paged by Tanktalus
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2014-09-20 22:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (163 votes), past polls