http://www.perlmonks.org?node_id=130244


in reply to Re: What are Modules
in thread What are Modules

George,

I agree with you, but I also think it is important for a newbie not to rely too much on modules because even though it will take more time to write your own code, I feel you learn Perl faster this way. This was the case when I started out. People were suggesting modules left and right and I said to myself "How am I going to learn this stuff if all I'm doing is using other people's code?"

Now that I have a better grasp on Perl, I find myself using CPAN much more. I would suggest to a newbie to try and write the code themselves first and then check out CPAN to see if a module can do something they want better/faster (which is usually the case).

Hope I don't get flamed for this, but this is the approach that I took.

-Dru

Replies are listed 'Best First'.
Re: Re: Re: What are Modules
by belg4mit (Prior) on Dec 07, 2001 at 21:44 UTC
    No flames, so long as you know you're wrong ;-) just kidding. Seriously though it's dependent on the end user. If they are the curious type and will actually attempt to understand the modules they use then that's good. I just rewrote a script from years ago that I used to select 5 random lines from a file that was atrocious, no scoping, vast assumptions (one of which was causing it to get locked in an infinite loop! Very Bad since it was run by cron), etc. etc. So I got Algorithm::Numerical::Shuffle and the script is now much more stable and trivial. And I really think that it would have been best for me to have used it in the first place long long ago. I would have been more confident in the script (or justifiably so), and spent time on making it work well instead of just making it work. On the other hand I wouldn't have been able to (it would have unnecessary) revisit it and see how very far I'd come ;-).

    --
    perl -p -e "s/(?:\w);([st])/'\$1/mg"

Re: Re: Re: What are Modules
by George_Sherston (Vicar) on Dec 08, 2001 at 00:23 UTC
    It's a balance, really, IMHO. One needs to have an idea how the modules work otherwise one can't use them intelligently. But at the same time one has to let them do the work otherwise there's no point. But my guess is that most beginners err on the side of *not* using modules, and will always find ways to practice their skills by re-inventing a whole load of wheels. I too learnt a fair amount by rolling my own, but I think I would have learnt other things quicker, and been more productive, if I'd made the jump to modules sooner.

    Also, a fab way to learn good programming style is to look at how the modules do it. So instead of learning by rolling one's own, one can learn by getting to grips with the real thing.

    § George Sherston