Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: OO-call bug uncovered & autovivified functions: defined? exists?

by Sidhekin (Priest)
on Oct 28, 2007 at 22:47 UTC ( #647756=note: print w/ replies, xml ) Need Help??


in reply to Re: OO-call bug uncovered & autovivified functions: defined? exists?
in thread OO-call bug uncovered & autovivified functions: defined? exists?

I don't think it makes semantic sense for exists to be applied to functions.

Nonetheless there are semantics for it.

sub E; # exists, but not defined sub D { 1 }; # exists _and_ defined # sub N does _not_ exist $\="\n"; print exists(&N) ? "N exists" : "N doesn't exist"; print exists(&E) ? "E exists" : "E doesn't exist"; print exists(&D) ? "D exists" : "D doesn't exist"; print defined(&N) ? "N is defined" : "N is not defined"; print defined(&E) ? "E is defined" : "E is not defined"; print defined(&D) ? "D is defined" : "D is not defined"; __END__ N doesn't exist E exists D exists N is not defined E is not defined D is defined

print "Just another Perl ${\(trickster and hacker)},"
The Sidhekin proves Sidhe did it!


Comment on Re^2: OO-call bug uncovered & autovivified functions: defined? exists?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (14)
As of 2015-07-28 12:08 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 (254 votes), past polls