le has asked for the wisdom of the Perl Monks concerning the following question:

I'm currently reading "Advanced Perl Programming" and I found the chapters about modules and OOP rather interesting.

I'd like to find out more and learn more about how modules work, how they can be implemented aso, and I thought I'd use the old free software motto: "Use the source, Luke!", and just look at the modules sources to see how their authors did it (the nice thing is that the modules user interface is explained good almost everytime in its perldoc).

There are many modules delivered with Perl itself and there are hundreds of other "good" modules in CPAN, the problem is that the popular modules like CGI or DBI are pretty big and too complex for a beginner like me, and I just can't figure out what module would be good to start with.

So, my question is: what modules would you recommend a beginner to take a look at? Or another question: would you recommend this approach of "learning by sourcing" at all?

(So to say: "Usually, all documentation files end up in .pm.")

Replies are listed 'Best First'.
Re: Module Recommendation
by perlmonkey (Hermit) on Jul 25, 2000 at 02:27 UTC
    One of the most brilliant perl programmers, Damian Conway, wrote a fantastic book "Object Oriented Perl" published by manning press (www.manning.com). Check it out, you wont be sorry.
        Thou MUST go to thy nearest Amazon dot and enter this holy scripture in thy quest box: 1884777791 and enlightement will be yours. amen
Re: Module Recommendation
by cwest (Friar) on Jul 25, 2000 at 06:53 UTC
    Just off the top of my head I might suggest reading File::Find, perhaps Cwd, they aren't object oriented though, but good reading for basic understanding...

    want an OO Module to read? hmm... read perltoot and (i think)perlboot. You might try something like FileHandle, it's got good use of Exporter and sub-classing...

    --
    Casey
    
Re: Module Recommendation
by Anonymous Monk on Jul 25, 2000 at 16:39 UTC
    I started learning Perl OO with this module Math::Matrix which seems to me quite simple.
    Then I tried to modified it to my needs.
    Once you become familiar with Perl OO, there are some modules like Class::Generate
    which do generally a better job.

    --
    Djelal
Re: Module Recommendation
by Anonymous Monk on Jul 25, 2000 at 18:50 UTC
    One way I think is nice to learn about modules is to start with a truly toy example, that has nothing but (say) a "hello world" sub defined in it, and just build it up from there. "Learn by doing." Of course I don't recommend this as the sole method! I think that the Perl Cookbook (the ram) and Effective Perl Programming both have excellent text-based introductions to modules and OOP in Perl. code> #!/usr/bin/perl package MyModule; sub hello { print "Hello, world!\n"; } 1; # modules must return true value </code> And then just go on from there. Probably the first thing you'll want to do is to export the sub, so you don't have to get used to namespace shifting all the time. So peek at just about *any* existing module and see how they use Exporter to export variables and subs into the main package. HTH, arturo