Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: Private Methods Meditation

by ihb (Deacon)
on Jul 20, 2004 at 00:39 UTC ( [id://375748]=note: print w/replies, xml ) Need Help??


in reply to Re: Private Methods Meditation
in thread Private Methods Meditation

I too am bother with this and I shrug when I see     $self->_private(@args) because hardly ever has the author documented &_private so I have to be extra careful when extending it and writing my own help routines.

And I really cry when I see     $self->_init(@_); in the parent class after trying to debug a totally innocent subclass, which happened to have a little help routine called &_init.

IMHO, it's just not particularly clever to call a "private" method as a method since you don't need the method dispatch to find the subroutine, plus you risk being accidently overridden.

Private methods should be invoked as (help) functions, because that's what they are.     _private($self => @args) is my preferred style.

ihb

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://375748]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-25 23:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found