Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: How can I re-program the exists function?

by tobyink (Abbot)
on Aug 24, 2012 at 15:35 UTC ( #989572=note: print w/ replies, xml ) Need Help??


in reply to How can I re-program the exists function?

I think the closest you could get would be to create your my_exists function taking a separate hashref and string as you already have, then use something like Devel::Declare or Devel::CallParser (perhaps coupled with PPI) to hook into the Perl compiler and translate this:

my_exists($hash{key})

to this during the parse/compile stage:

my_exists(\%{hash}, 'key')

It's not an easy task though.

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


Comment on Re: How can I re-program the exists function?
Select or Download Code
Re^2: How can I re-program the exists function?
by Anonymous Monk on Aug 24, 2012 at 16:25 UTC

    t's not an easy task though.

    See Method::Signatures , it looks easy enough to copy that :)

Re^2: How can I re-program the exists function?
by greengaroo (Hermit) on Aug 27, 2012 at 15:40 UTC

    Thanks, but I don't think it's worth it. It is not that important since I managed to make it work.

    There are no stupid questions, but there are a lot of inquisitive idiots.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2014-07-26 00:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls