Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Is it a good idea to create custom modules?

by Excalibor (Pilgrim)
on Aug 09, 2001 at 23:09 UTC ( [id://103571]=note: print w/replies, xml ) Need Help??


in reply to Is it a good idea to create custom modules?

Hi there,

I absolutely agree with dragonchild. It's a good idea to create your own library, actually CPAN is based exactly on the: code re-use and encapsulation of functionality, so both good things (what's supposed to do) and (possible) bugs are well localized and easily tracked down.

However, create good modules that don't pollute the main package namespace, document them (POD (man perlpod) is good for that, in-place documentation). Use obvious, self-describing names and use them consistently and everywhere they apply, this way your code will be easy to follow for anyone reading it (for once read, every programmer will know what it does in every program you write). Sometime, encapsulating standard modules and pragmas like you do makes things harder to read until you get used. Some people like to be very explicit about imports and anything that may affect the way a program runs, but if you are comfortable with it, just go ahead, document it well and use it everywhere it's sensible...

I, particularly, don't like to export anything, and prefer to fully qualify names so there's no confusion about where this function came from, etc, but as this can easily become too verbose, some standard, well known modules, may be used without fear, although @EXPORT_OK is cleaner for this.

Good luck!

our $Perl6 is Fantastic;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2024-03-19 02:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found