Created
January 6, 2012 21:50
-
-
Save exodist/1572555 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Foo; | |
use strict; | |
use warnings; | |
use Test::More; | |
BEGIN { $INC{'Foo.pm'} = __FILE__ } | |
sub import { | |
my $class = shift; | |
my $caller = caller; | |
no strict 'refs'; | |
*{"$caller\::foo"} = sub { | |
$^H{'Foo'} ||= bless {'caller' => $caller}, $class; | |
}; | |
} | |
sub DESTROY { | |
my $self = shift; | |
local $SIG{__DIE__} = sub { warn @_; exit 1 }; | |
print "doing something like $self->{caller}\->meta->make_immutible...\n"; | |
} | |
package Bar; | |
use strict; | |
use warnings; | |
use Test::More; | |
use Data::Dumper; | |
use Foo; | |
print "A\n"; | |
foo blah => ( | |
doesnt => 'matter', | |
); | |
print "B\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment