Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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 making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2015-07-03 00:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (47 votes), past polls