in reply to Module Bloat and the Best Solution

I'm not even going to look at your example. But I'll give you my general rule of thumb instead:
Use a module if it's very likely that the code you'd write instead of using the module, will contain a bug.
I care about writeability, not readability of the code. After all, we're above copy/paste programming, aren't we? Aren't we?

That's what I thought.

Replies are listed 'Best First'.
Re^2: Module Bloat and the Best Solution
by BrowserUk (Patriarch) on Nov 12, 2007 at 17:17 UTC
      Copy/paste programming, as I understand it, is looking up code where you did something similar, copy and paste it into your script, and then edit what needs to be different.

      If you need to do this, this shows to me that there's something wrong with the language you're using, or at least, with the way you're using it. A sign of weakness — especially if that's the best way to do it.

        So, is it copy/paste programming if I use for my $i ( 1 .. 10 ) { in two different programs?

        Should I do that as:

        use Useful::For qw[ ForRange ]; ForRange \my $i, 1, 10, { print $$i; }

        ?

        How about a Useful::If, and a Useful::While and a ...

        Of course, now all our programs have to start with:

        use Useful::For qw[ ForRange ]; use UseFul::If; use UseFul::While; ...

        But that is so repetative. That has to be a candidate for a module right!

        use Useful; Use qw[ For If While ]; ...

        But hang on. We lost the ability to select individual routines from each module. We have to fix that, so:

        use Useful; Useful { For => qw[ ForRange ], If => qw[ :all ], While => qw[ :all ], };

        Better, but still a lot of C&P. How about:

        use Perl qw[ :all ];

        Perfect!


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.