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. | [reply] |
| [reply] |
Thou MUST go to thy nearest Amazon dot and
enter this holy scripture in thy quest box:
1884777791
and enlightement will be yours.
amen
| [reply] |
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
| [reply] |
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 | [reply] |
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
| [reply] |