=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<no indirect>), 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<sub> isn't defined, C<sub $x> is actually interpreted as C<< $x->sub >>).