Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re^4: undef/defined &{$name} while "strict refs"

by anazawa (Scribe)
on Aug 21, 2012 at 07:04 UTC ( #988608=note: print w/replies, xml ) Need Help??

in reply to Re^3: undef/defined &{$name} while "strict refs"
in thread undef/defined &{$name} while "strict refs"

The POD says we are allowed to get a reference to CODE using symbolic references while "strict refs". I think this doesn't mean we can defined or undef subroutines as well. I may be misreading the document.

Replies are listed 'Best First'.
Re^5: undef/defined &{$name} while "strict refs"
by Anonymous Monk on Aug 21, 2012 at 07:22 UTC

    I think this doesn't mean we can defined or undef subroutines as well.

    I don't understand what you're saying here

      When we execute my code above, the script throws an exception because &{ 'run' } violates "strict refs". Khen1950fx explained how to avoid this problem (I appreciate his suggestion).

      On the other hand, when we comment out &{ 'run' }, my script doesn't output error messages. This result shows the following doesn't violate "strict refs":
      my $walkable = defined &{ 'walk' }; undef &{ 'walk' };
      It seems each line uses symbolic references. I don't understand why this is possible.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://988608]
[LanX]: unusual that "Pimp my Bride" never made it into TV (?)
LanX sighs ... no idea stupid enough
[choroba]: "Smack My Bitch Up" did, though
[Eily]: that's the internet for you LanX
[Eily]: and I'm pretty sure there's a rule somewhere that states that the stupider the idea, the more likely it is to already have been done
zentara is thinking of moving to Mars to esacpe it all
[LanX]: Zentara eq Dr Manhatten ?

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (12)
As of 2017-03-27 15:21 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (320 votes). Check out past polls.