Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re^3: Passing the logger's objectby stevieb (Canon) |
on Nov 13, 2016 at 20:42 UTC ( [id://1175841]=note: print w/replies, xml ) | Need Help?? |
Not always, but mostly I do. Whether using named params:
or, positional (in this case, I typically have the log obj as the first parameter):
...and sometimes, I'll have the first arg as $self, then the log obj, then named params after that:
The new() method would look something like this internally in that case:
You can also call the class method within your new() method, and stash it inside the object:
In Section
Seekers of Perl Wisdom
|
|