Kevin Ryde > chart > App::Chart::Glib::Ex::ChildPid

Download:
chart-251.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

New  15
Open  4
View/Report Bugs
Source  

NAME ^

App::Chart::Glib::Ex::ChildPid -- object holding child process ID

SYNOPSIS ^

 use App::Chart::Glib::Ex::ChildPid;
 my $pobj = App::Chart::Glib::Ex::ChildPid->new (pid => $pid);

 $pobj->kill ('INT');
 $pobj->terminate_with_timeout;

DESCRIPTION ^

A App::Chart::Glib::Ex::ChildPid holds the process ID (an integer) for a child process created by fork or similar spawn.

The fork and subprocess emulation described in perlfork doesn't work with Glib process watching (as of Perl-Glib 1.200) and cannot be used with App::Chart::Glib::Ex::ChildPid.

FUNCTIONS ^

$pobj->kill ()
$pobj->kill ($sig)

Send signal $sig to the $pobj process. $sig defaults to SIGTERM, otherwise it's a string or number per the core kill function (see "kill" in perlfunc).

$pobj->wait ()
$pobj->wait ($flags)

Block and wait for the $pobj process to terminate, as per the core waitpid. The exited signal is also emitted in the usual way if it terminates.

PROPERTIES ^

pid (integer, default 0)

The process ID held and operated on. It must be an immediate child of the current process, but can be started by either fork or any of the several Perl fork/spawn/open modules.

exited (boolean, default false)

The process ID held and operated on. It must be an immediate child of the current process, but can be started by either fork or any of the several Perl fork/spawn/open modules.

kill-on-destroy (boolean, default true)

If true then when the ChildPid object is destroyed through garbage collection the process is killed and waited if that hasn't already been done.

This is true by default to ensure the child process stops when the parent stops, or when you discard the object as no longer wanted.

SIGNALS ^

exited ($status)

Emitted when the child process exits, either normally or killed by a signal, but not when merely paused by SIGSTOP, SIGTSTP, etc.

This is implemented by a Glib::Child->add_watch (see Glib::MainLoop). Note that function uses SIGCHLD and if you install your own $SIG{'CHLD'} handler then exited won't run.

SEE ALSO ^

Glib::MainLoop, IPC::Open3, Proc::SyncExec

syntax highlighting: