Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

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

by anazawa (Scribe)
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?
[AnomalousMonk]: LanX: I should have written "vessel". Rama was (is? - I'm still hoping) no asteroid.
[erix]: itym vehicle (vessel is for water-vehicles)
[erix]: then again you may be a native speaker and I'd do better to shut up :)
[AnomalousMonk]: erix: s/vessel/vehicle/

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (12)
As of 2017-11-22 17:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (327 votes). Check out past polls.

    Notices?