Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Using delete package::{subroutine} to change resolution of subroutines

by ikegami (Patriarch)
on Jun 22, 2008 at 06:56 UTC ( [id://693342]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    *{main::open} = sub { print "Ho\n"; };
    
  2. or download this
    my $glob_ref = do { no strict 'refs'; \*{'main::open'} };
    *$glob_ref = sub { print "Ho\n"; };
    
  3. or download this
    BEGIN {
            # Deleting and remaking the sub fails! ;(
    ...
            *{main::open} = sub { print "Ho\n"; };
            use subs 'open';
    }
    
  4. or download this
    BEGIN {
            # Deleting and remaking the sub fails! ;(
    ...
                    import subs 'open';
            }
    }
    
  5. or download this
    use strict;
    use warnings;
    ...
    }
    
    open(my $fh5, '<', $0);  # Calls CORE::open
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2024-07-18 08:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.