GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Process::Status(3) User Contributed Perl Documentation Process::Status(3)

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

version 0.009

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 just an integer, 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. It exists almost entirely to provide "as_struct" and "as_string", which provide a simple decomposition of $?.

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.

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

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

This method returns true if the status code is zero.

This method returns the exit status encoded in the status. In other words, it's the number in the top eight bits.

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

This method returns true if the process dumped core.

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

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

Roughly, you might get things like this:

  exited 0
  exited 92
  exited 2, caught SIGDERP
  exited 2, caught SIGSEGV; dumped core

  Process::Status->assert_ok($program_name);

This method does nothing if $? is 0. Otherwise, it croaks with a message like:

  your-program-name exited 13, caught SIGNES

If a program name is not provided, "program" is used.

Ricardo Signes <rjbs@cpan.org>

  • Michael McClimon <michael@mcclimon.org>
  • Ricardo Signes <rjbs@semiotic.systems>

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.

2020-04-08 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.