Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

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

by anazawa (Beadle)
on Aug 21, 2012 at 19:49 UTC ( #988837=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $bool = defined &{ 'foo::bar' };
    
  2. or download this
    my $namespace = do { no strict 'refs'; \%{"foo::"} };
    my $bool = exists $namespace->{bar} && defined *{ $namespace->{bar} }{
    +CODE};
    
  3. or download this
    no strict 'refs';
    my $before = exists $foo::{bar}; # false
    my $bool = defined *{ 'foo::bar' }{CODE};
    my $after = exists $foo::{bar}; # true
    
  4. or download this
    undef &{ 'foo::bar' };
    no strict 'refs';
    *{ 'foo::bar' } = sub {};
    
  5. or download this
    no strict 'refs';
    no warnings 'redefine';
    *{ 'foo::bar' } = sub {};
    
  6. or download this
    my $coderef = \&{ 'subroutine_name' }; 
    #undef $$coderef; # typo ?
    undef &{ $coderef }; 
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2014-07-31 00:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (242 votes), past polls