From: Vincent Pit Date: Tue, 14 Jul 2009 12:36:46 +0000 (+0200) Subject: Make the default error message public X-Git-Tag: v0.16~11 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=a5339a6ced4d5e3ad1541320476c3d6bf8ff9408;p=perl%2Fmodules%2Findirect.git Make the default error message public --- diff --git a/lib/indirect.pm b/lib/indirect.pm index 63df3d8..53dc846 100644 --- a/lib/indirect.pm +++ b/lib/indirect.pm @@ -86,10 +86,6 @@ Otherwise, a warning will be emitted for each indirect construct. =cut -my $msg = sub { - "Indirect call of method \"$_[1]\" on object \"$_[0]\" at $_[2] line $_[3].\n" -}; - sub unimport { shift; @@ -99,11 +95,11 @@ sub unimport { if ($arg eq 'hook') { $hook = shift; } elsif ($arg eq ':fatal') { - $hook = sub { die $msg->(@_) }; + $hook = sub { die msg(@_) }; } last if $hook; } - $hook = sub { warn $msg->(@_) } unless defined $hook; + $hook = sub { warn msg(@_) } unless defined $hook; $^H |= 0x00020000; $^H{+(__PACKAGE__)} = _tag($hook); @@ -122,6 +118,18 @@ sub import { (); } +=head1 FUNCTIONS + +=head2 C + +Returns the default error message generated by C when an invalid construct is reported. + +=cut + +sub msg { + "Indirect call of method \"$_[1]\" on object \"$_[0]\" at $_[2] line $_[3].\n" +}; + =head1 CONSTANTS =head2 C