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

NAME

Process::Status - a handle on process termination, like $?

VERSION

version 0.002

OVERVIEW

When you run a system command with system or qx`` or a number of other mechanisms, the process termination status gets put into $? as an integer. In C, it's a value of type pid_t, and it stores a few pieces of data in different bits.

Process::Status just provides a few simple methods to make it easier to inspect. Almost the sole reason it exists is for its as_struct method, which can be passed to a pretty printer to dump $? in a somewhat more human-readable format.

Methods called on Process::Status without first calling a constructor will work on an implicitly-constructed object using the current value of $?. To get an object for a specific value, you can call new and pass an integer. You can also call new with no arguments to get an object for the current value of $?, if you want to keep that ugly variable out of your code.

METHODS

new

  my $ps = Process::Status->new( $pid_t );
  my $ps = Process::Status->new; # acts as if you'd passed $?

pid_t

This returns the value of the pid_t integer, as you might have found in $?.

is_success

This method returns true if the pid_t is zero.

exitstatus

This method returns the exit status of the pid_t.

signal

This returns the signal caught by the process, or zero.

cored

This method returns true if the process dumped core.

as_struct

This method returns a hashref describing the status. Its exact contents may change over time; it is meant for human, not computer, consumption.

AUTHOR

Ricardo Signes <rjbs@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Ricardo Signes.

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