sub action {
my ($self, $cmd, $pkg) = @_;
- $cmd = $self->cmd if !defined $cmd
- and defined $self and $self->isa(__PACKAGE__);
- return unless defined $cmd;
+ if (not defined $cmd) {
+ return unless defined $self and ref $self and $self->isa(__PACKAGE__);
+ $cmd = $self->cmd;
+ }
unless (defined $pkg) {
return __PACKAGE__ . '::Each' unless defined $commands{$cmd};
return $commands{$cmd}