Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^5: How do you find keys of a Blessed Hash?

by tobyink (Abbot)
on Oct 08, 2012 at 13:06 UTC ( #997814=note: print w/ replies, xml ) Need Help??


in reply to Re^4: How do you find keys of a Blessed Hash?
in thread How do you find keys of a Blessed Hash?

keys $blessed doesn't work for a very good reason. keys can (in recent versions of Perl) be used with either arrays or hashes. A blessed object can (thanks to overload) be simultaneously dereferencable as a hash and and array. So for blessed objects, you need to manually dereference.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'


Comment on Re^5: How do you find keys of a Blessed Hash?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2014-09-19 16:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (143 votes), past polls