June 2005
Beginner
480 pages
10h 31m
English
| Q1: | Can I put functions in my class, and call them directly without an object? |
| A1: | Yes. In object-oriented terminology these are called class methods. To call a subroutine named doit (and retrieve its value) in a class named Widget you can do any of the following:
$value = Widget->doit(); $value = Widget::doit(); $value = doit Car; The last one may look odd, but it's a piece of syntax sugar that means the same thing as the others. |
| Q2: | This hour missed a lot of object-oriented stuff. There was no inheritance! No polymorphism! |
| A2: | There's far, far too much to cover in an hour. Perl includes these manual pages dedicated to objects: perlboot, perltoot, perltootc, perlobj, and perlbot. For an entire book on Perl objects, I'd recommend Object Oriented ... |
Read now
Unlock full access