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

Re^3: OOP: ->Coderef for calling Private Methods

by ccn (Vicar)
on Dec 13, 2008 at 19:48 UTC ( #730189=note: print w/replies, xml ) Need Help??


in reply to Re^2: OOP: ->Coderef for calling Private Methods
in thread OOP: Obj->Coderef for calling Private Methods

Perl 5.6 does not have that feature (perlop 5.6). That explains why hackers use underscores and merlyn did not mention it in his book.

Perl doesn't care about $code_ref having to be a reference to a method. It's enough to be just a sub ref. The sub gets an $obj as first argument, that's all.

Update: broken link fixed

Replies are listed 'Best First'.
Re^4: OOP: ->Coderef for calling Private Methods (5.6?)
by tye (Sage) on Dec 13, 2008 at 20:19 UTC
    Perl 5.6 does not have that feature

    Testing 5.005_03 shows that even it had the feature of $obj->$code_ref( ... ), despite the 5.6 documentation not mentioning it:

    $ perl5.00503 -e '$cr= sub { warn "( @_ )\n" }; "main"->$cr( "bar" )' ( main bar )

    - tye        

Re^4: OOP: ->Coderef for calling Private Methods
by LanX (Chancellor) on Dec 13, 2008 at 19:50 UTC
    Thank you that's helpful! 8 )

    Do you agree that it could be more documented?

    Cheers Rolf

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://730189]
help
Chatterbox?
and snow settles gently...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2016-12-09 11:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (150 votes). Check out past polls.