Package Info

perl-Proc-Simple


Launch and Control Background Processes


Development/Libraries/Perl

The Proc::Simple package provides objects mimicing real-life processes from a user's point of view. A new process object is created by

$myproc = Proc::Simple->new();

Either external programs or perl subroutines can be launched and controlled as processes in the background.

A 10-second sleep process, for example, can be launched as an external program as in

$myproc->start("/bin/sleep 10"); # or $myproc->start("/bin/sleep", "10");

or as a perl subroutine, as in

sub mysleep { sleep(shift); } # Define mysleep() $myproc->start(&mysleep, 10); # Launch it.

or even as

$myproc->start(sub { sleep(10); });

The start Method returns immediately after starting the specified process in background, i.e. there's no blocking. It returns 1 if the process has been launched successfully and 0 if not.

The poll method checks if the process is still running

$running = $myproc->poll();

and returns 1 if it is, 0 if it's not. Finally,

$myproc->kill();

terminates the process by sending it the SIGTERM signal. As an option, another signal can be specified.

$myproc->kill("SIGUSR1");

sends the SIGUSR1 signal to the running process. kill returns 1 if it succeeds in sending the signal, 0 if it doesn't.

The methods are discussed in more detail in the next section.

A destructor is provided so that a signal can be sent to the forked processes automatically should the process object be destroyed or if the process exits. By default this behaviour is turned off (see the kill_on_destroy and signal_on_destroy methods).


License: GPL-1.0+ or Artistic-1.0
URL: http://search.cpan.org/dist/Proc-Simple/

Categories

Releases

Package Version Update ID Released Package Hub Version Platforms Subpackages
1.32-bp155.2.9 info GA Release 2023-05-17 15 SP5
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Proc-Simple
1.32-bp154.1.19 info GA Release 2022-05-09 15 SP4
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Proc-Simple
1.32-bp153.1.14 info GA Release 2021-03-06 15 SP3
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Proc-Simple
1.32-bp152.3.13 info GA Release 2020-04-16 15 SP2
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Proc-Simple
1.32-bp151.3.1 info GA Release 2019-07-17 15 SP1
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Proc-Simple
1.32-bp151.2.12 info GA Release 2019-05-18 15 SP1
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Proc-Simple
1.32-bp150.2.4 info GA Release 2018-07-30 15
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Proc-Simple