App-Cmd

 view release on metacpan or  search on metacpan

lib/App/Cmd.pm  view on Meta::CPAN

  my $arg0 = $0;
  my $base = File::Basename::basename $arg0;

  my $self = {
    command      => $class->_command($arg),
    arg0         => $base,
    full_arg0    => $arg0,
    show_version => $arg->{show_version_cmd} || 0,
  };

  bless $self => $class;
}

# effectively, returns the command-to-plugin mapping guts of a Cmd
# if called on a class or on a Cmd with no mapping, construct a new hashref
# suitable for use as the object's mapping
sub _command {
  my ($self, $arg) = @_;
  return $self->{command} if ref $self and $self->{command};

  # TODO _default_command_base can be wrong if people are not using

lib/App/Cmd/Command.pm  view on Meta::CPAN


#pod =method new
#pod
#pod This returns a new instance of the command plugin.  Probably only C<prepare>
#pod should use this.
#pod
#pod =cut

sub new {
  my ($class, $arg) = @_;
  bless $arg => $class;
}

#pod =method execute
#pod
#pod   $command_plugin->execute(\%opt, \@args);
#pod
#pod This method does whatever it is the command should do!  It is passed a hash
#pod reference of the parsed command-line options and an array reference of left
#pod over arguments.
#pod

lib/App/Cmd/Tester.pm  view on Meta::CPAN

    error  => $error,
    run_rv => $run_rv,
  };
}

{
  package App::Cmd::Tester::Result;
$App::Cmd::Tester::Result::VERSION = '0.331';
sub new {
    my ($class, $arg) = @_;
    bless $arg => $class;
  }

  for my $attr (qw(app stdout stderr output error run_rv exit_code)) {
    Sub::Install::install_sub({
      code => sub { $_[0]->{$attr} },
      as   => $attr,
    });
  }
}

{
  package App::Cmd::Tester::Exited;
$App::Cmd::Tester::Exited::VERSION = '0.331';
sub throw {
    my ($class, $code) = @_;
    $code = 0 unless defined $code;
    my $self = (bless \$code => $class);
    die $self;
  }
}

1;

__END__

=pod

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.978 second using v1.00-cache-1.14-grep-28634ff-cpan-4d46879620f )