From: Vincent Pit Date: Sun, 3 May 2009 14:23:54 +0000 (+0200) Subject: Freshen the synopsis X-Git-Tag: v0.12~2 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Findirect.git;a=commitdiff_plain;h=d818cd7cde8dc811471d3b02134e043077bd55e4 Freshen the synopsis --- diff --git a/lib/indirect.pm b/lib/indirect.pm index 6354a13..3794554 100644 --- a/lib/indirect.pm +++ b/lib/indirect.pm @@ -22,15 +22,27 @@ BEGIN { =head1 SYNOPSIS + # In a script no indirect; my $x = new Apple 1, 2, 3; # warns { use indirect; my $y = new Pear; # ok + { + no indirect hook => sub { die "You really wanted $_[0]\->$_[1]" }; + my $z = new Pineapple 'fresh'; # croaks 'You really wanted Pineapple->new' + } } no indirect ':fatal'; if (defied $foo) { ... } # croaks, note the typo + # From the command-line + perl -M-indirect -e 'my $x = new Banana;' # warns + + # Or each time perl is ran + export PERL5OPT="-M-indirect" + perl -e 'my $y = new Coconut;' # warns + =head1 DESCRIPTION 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 is actually interpreted as C<< $x->sub >>).