The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

IPC::Open3::Callback::CommandFailedException - An exception thrown when run_or_die encounters a failed command

VERSION

version 1.14

SYNOPSIS

  use IPC::Open3::Callback::CommandRunner;
  
  my $runner = IPC::Open3::Callback::CommandRunner->new();
  eval {
      $runner->run_or_die( 'echo Hello World' );
  };
  if ( $@ && ref( $@ ) eq 'IPC::Open3::Callback::CommandFailedException' ) {
      # gather info
      my $command = $@->get_command(); # an arrayref
      my $exit_status = $@->get_exit_status();
      my $out = $@->get_out();
      my $err = $@->get_err();
      
      # or just print 
      print( "$@\n" ); # includes all info
  }

DESCRIPTION

This provides a container for information obtained when a command fails. The command and exit_status will always be available, but out and err will only be present if you supply the command option out_buffer => 1 and err_buffer => 1 respectively.

ATTRIBUTES

get_command()

Returns a reference to the array supplied as the command to command runner.

get_exit_status()

Returns the exit status from the attempt to run the command.

get_out()

Returns the text written to STDOUT by the command. Only present if out_buffer was requested as a command runner option.

get_err()

Returns the text written to STDERR by the command. Only present if err_buffer was requested as a command runner option.

METHODS

to_string()

Returns a string representation of all of the attributes. The qw{""} operator is overridden to call this method.

AUTHORS

  • Lucas Theisen <lucastheisen@pastdev.com>

  • Alceu Rodrigues de Freitas Junior <arfreitas@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Lucas Theisen.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

SEE ALSO

Please see those modules/websites for more information related to this module.