|
|
| We don't bite newbies here... much | |
| PerlMonks |
Re: perl oop conceptby tobyink (Prior) |
| on Dec 04, 2012 at 07:07 UTC ( #1007022=note: print w/ replies, xml ) | Need Help?? |
|
This looks like OOP code:
However, the last line there is generally considered poor style. Try:
But these lines seem to bear no relation to OOP:
Try something like this:
That should give you an idea how OOP works. That said, I'd recommend using Moose or Moo as a way of reducing repetitive OOP code...
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||