=head1 VERSION
-Version 0.13
+Version 0.15
=cut
our $VERSION;
BEGIN {
- $VERSION = '0.13';
+ $VERSION = '0.15';
}
=head1 SYNOPSIS
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 hook => sub { die "You really wanted $_[0]\->$_[1] at $_[2]:$_[3]" };
+ my $z = new Pineapple 'fresh'; # croaks 'You really wanted Pineapple->new at blurp.pm:13'
}
}
no indirect ':fatal';
=cut
-my $msg = sub {
- "Indirect call of method \"$_[1]\" on object \"$_[0]\" at $_[2] line $_[3].\n"
-};
-
sub unimport {
shift;
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);
();
}
+=head1 FUNCTIONS
+
+=head2 C<msg $object, $method, $file, $line>
+
+Returns the default error message generated by C<indirect> 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<I_THREADSAFE>
-True iff the module could have been built when thread-safety features.
+True iff the module could have been built with thread-safety features enabled.
=head1 CAVEATS