Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^4: if(my) scope

by oeuftete (Monk)
on Apr 16, 2009 at 11:21 UTC ( #757941=note: print w/ replies, xml ) Need Help??


in reply to Re^3: if(my) scope
in thread if(my) scope

It's definitely out of scope.

package H; sub DESTROY { print "DESTROY\n"; } sub new { my $class = shift; bless {}, $class; } sub foo { } package main; { if ( my $h = H->new() ) { print "IN\n"; $h->foo; } print "\$h out of scope?\n"; eval { $h->foo }; print $@ if $@; } print "why now?\n"; IN $h out of scope? Can't call method "foo" on an undefined value at /home/me/tmp/pm757929 +.pl line 15. DESTROY why now?


Comment on Re^4: if(my) scope
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (17)
As of 2015-07-30 16: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 (273 votes), past polls