X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;ds=sidebyside;f=lib%2Findirect.pm;h=af8d4f7a8c71efaacbbc40e5ee60ae42fed3be68;hb=ff16be2f69592b80dfcbc397b37dd4ea070b9d62;hp=53dc846c35692076b047854e0aafa6f41e031276;hpb=a5339a6ced4d5e3ad1541320476c3d6bf8ff9408;p=perl%2Fmodules%2Findirect.git diff --git a/lib/indirect.pm b/lib/indirect.pm index 53dc846..af8d4f7 100644 --- a/lib/indirect.pm +++ b/lib/indirect.pm @@ -48,7 +48,7 @@ BEGIN { When enabled (or disabled as some may prefer to say, since you actually turn it on by calling C), this pragma warns about indirect object syntax constructs that may have slipped into your code. This syntax is now considered harmful, since its parsing has many quirks and its use is error prone (when C isn't defined, C actually compiles to C<< $x->swoosh >>). -It currently does not warn when the object is enclosed between braces (like C) or for core functions (C or C). +It currently does not warn for core functions (C, C, C or C). This may change in the future, or may be added as optional features that would be enabled by passing options to C. This module is B a source filter. @@ -127,7 +127,11 @@ Returns the default error message generated by C when an invalid const =cut sub msg { - "Indirect call of method \"$_[1]\" on object \"$_[0]\" at $_[2] line $_[3].\n" + my $obj = $_[0]; + + join ' ', "Indirect call of method \"$_[1]\" on", + ($obj =~ /^\s*\{/ ? "a block" : "object \"$obj\""), + "at $_[2] line $_[3].\n"; }; =head1 CONSTANTS