X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Findirect.git;a=blobdiff_plain;f=lib%2Findirect.pm;h=c068be73fa8e42e43bbf961f4343ff698cc3c1ec;hp=51b69d15205bbd2f72a545a2b7c9fe8c12555bd1;hb=12f5aa96d0f4d2275aafa29bc76c96a0d4f215a9;hpb=3b757f7116ccdc022577b2d5f177556c78bcfeb8 diff --git a/lib/indirect.pm b/lib/indirect.pm index 51b69d1..c068be7 100644 --- a/lib/indirect.pm +++ b/lib/indirect.pm @@ -58,12 +58,19 @@ BEGIN { sub import { $^H{+(__PACKAGE__)} = undef; + (); } +my $msg = sub { "Indirect call of method \"$_[1]\" on object \"$_[0]\"" }; + sub unimport { (undef, my $type) = @_; $^H |= 0x00020000; - $^H{+(__PACKAGE__)} = (defined $type and $type eq ':fatal') ? 2 : 1; + my $cb = (defined $type and $type eq ':fatal') + ? sub { die $msg->(@_) } + : sub { warn $msg->(@_) }; + $^H{+(__PACKAGE__)} = _tag($cb); + (); } =head1 CAVEATS