in reply to kind of effort required for learning OO perl ?!
Hi,
I learned OO Perl from the book "Object oriented Perl". Its pretty old so you can buy it second hand real cheap but its a jewel.
OO Perl is very easy, it uses 3 steps:
- To create a class, create a package
Just as you normally create a package, but do not export anything.
- To create methods, write subroutines
Methods are just subroutines, but instead of using the data in a class, they use the pointer to a blessed hash. Example:
sub return_output { my ($self,%args) = @_; return $self->{output}; }
- To create objects, bless a referent
The constructor blesses a reference to an anonymous hash and returns it. It uses function bless for this.
So its real easy, if I were you I would start with reading "Object oriented Perl" (as I did recently, I bought the book second hand for 5 euros but its worth much more).
|
---|