package NEXT;
-$VERSION = '0.61';
+$VERSION = '0.64';
use Carp;
use strict;
use overload ();
my $caller = (caller($depth))[3];
my $wanted = $NEXT::AUTOLOAD || $autoload_name;
undef $NEXT::AUTOLOAD;
- my ($caller_class, $caller_method) = $caller =~ m{(.*)::(.*)}g;
- my ($wanted_class, $wanted_method) = $wanted =~ m{(.*)::(.*)}g;
+ my ($caller_class, $caller_method) = do { $caller =~ m{(.*)::(.*)}g };
+ my ($wanted_class, $wanted_method) = do { $wanted =~ m{(.*)::(.*)}g };
croak "Can't call $wanted from $caller"
unless $caller_method eq $wanted_method;
last if shift @forebears eq $caller_class
}
no strict 'refs';
- @{$NEXT::NEXT{$key,$wanted_method}} =
- map { *{"${_}::$caller_method"}{CODE}||() } @forebears
+ @{$NEXT::NEXT{$key,$wanted_method}} =
+ map {
+ my $stash = \%{"${_}::"};
+ ($stash->{$caller_method} && (*{$stash->{$caller_method}}{CODE}))
+ ? *{$stash->{$caller_method}}{CODE}
+ : () } @forebears
unless $wanted_method eq 'AUTOLOAD';
- @{$NEXT::NEXT{$key,$wanted_method}} =
- map { (*{"${_}::AUTOLOAD"}{CODE}) ? "${_}::AUTOLOAD" : ()} @forebears
+ @{$NEXT::NEXT{$key,$wanted_method}} =
+ map {
+ my $stash = \%{"${_}::"};
+ ($stash->{AUTOLOAD} && (*{$stash->{AUTOLOAD}}{CODE}))
+ ? "${_}::AUTOLOAD"
+ : () } @forebears
unless @{$NEXT::NEXT{$key,$wanted_method}||[]};
$NEXT::SEEN->{$key,*{$caller}{CODE}}++;
}
my $call_method = shift @{$NEXT::NEXT{$key,$wanted_method}};
- while ($wanted_class =~ /^NEXT\b.*\b(UNSEEN|DISTINCT)\b/
+ while (do { $wanted_class =~ /^NEXT\b.*\b(UNSEEN|DISTINCT)\b/ }
&& defined $call_method
&& $NEXT::SEEN->{$key,$call_method}++) {
$call_method = shift @{$NEXT::NEXT{$key,$wanted_method}};
}
unless (defined $call_method) {
- return unless $wanted_class =~ /^NEXT:.*:ACTUAL/;
+ return unless do { $wanted_class =~ /^NEXT:.*:ACTUAL/ };
(local $Carp::CarpLevel)++;
croak qq(Can't locate object method "$wanted_method" ),
qq(via package "$caller_class");
};
return $self->$call_method(@_[1..$#_]) if ref $call_method eq 'CODE';
no strict 'refs';
- ($wanted_method=${$caller_class."::AUTOLOAD"}) =~ s/.*:://
+ do { ($wanted_method=${$caller_class."::AUTOLOAD"}) =~ s/.*::// }
if $wanted_method eq 'AUTOLOAD';
$$call_method = $caller_class."::NEXT::".$wanted_method;
return $call_method->(@_);
my $caller = (caller($depth))[3];
my $wanted = $EVERY::AUTOLOAD || $autoload_name;
undef $EVERY::AUTOLOAD;
- my ($wanted_class, $wanted_method) = $wanted =~ m{(.*)::(.*)}g;
+ my ($wanted_class, $wanted_method) = do { $wanted =~ m{(.*)::(.*)}g };
my $key = ref($self) && overload::Overloaded($self)
? overload::StrVal($self) : $self;
my @forebears = NEXT::ELSEWHERE::ordered_ancestors ref $self || $self,
$wanted_class;
- @forebears = reverse @forebears if $wanted_class =~ /\bLAST\b/;
+ @forebears = reverse @forebears if do { $wanted_class =~ /\bLAST\b/ };
no strict 'refs';
my %seen;
my @every = map { my $sub = "${_}::$wanted_method";