Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Modules, Frameworks, and Reinventing the Wheel

by water (Deacon)
on Aug 13, 2004 at 12:59 UTC ( #382645=note: print w/replies, xml ) Need Help??

in reply to Modules, Frameworks, and Reinventing the Wheel

modules ++

frivolous module use --

mom and apple pie ++

Seriously, we favor two kinds of modules --
  • objects -- with encapsulated data, public & private methods, and numerous unit tests,
  • exported subroutines -- with complex behavior, no side effects, and numerous unit tests
In both case, wrapping it up a module allows cleaner code, easier refactoring, and better documentation. Consider something like this
if (! &valid_foozle_input($wozzle)) {
if ($wozzle =~ /extensive-perl-regexp-line-noise-here/ {
The former clearly indicates what is going on, the documention on what makes something fozzle_valid can go into the module (sub or object, depending), you can now write unit tests against the sub, you can use the sub in numerous places across the codebase (instead of just in this file, as a local sub would require), not have repeated code, etc.

just my two cents -- your mileage may vary

water from the great white north

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2021-01-16 11:37 GMT
Find Nodes?
    Voting Booth?