Skip to content

Instantly share code, notes, and snippets.

@mpeters
Created July 21, 2011 14:59
Show Gist options
  • Save mpeters/1097373 to your computer and use it in GitHub Desktop.
Save mpeters/1097373 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use Carp;
print "Orig : " . \&Carp::confess . "\n";
my $copy = \&Carp::confess;
print "Copy : $copy\n";
my $new = sub {};
print "New : $new\n";
{
no warnings 'redefine';
*Carp::confess = $new;
print "Changed: " . \&Carp::confess . "\n";
*Carp::confess = $copy;
print "Revert : " . \&Carp::confess . "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment