The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Run - Perl extension for to start programs in background

SYNOPSIS

  use Run;
  $pid = spawn 'long_running_task', 'arg1', 'arg2' or die "spawn: $!";
  do_something_else();
  waitpid($pid,0);

DESCRIPTION

The subroutine spawn is equivalent to the builtin system (see "system LIST" in perlfunc) with the exceptions that the program is started in background, and the return the pid of the kid.

Returns 0 on failure, $! should contain the reason for the failure.

EXPORT

Exports spawn by default.

AUTHOR

Ilya Zakharevich <ilya@math.ohio-state.edu

TODO

What to do with errs in or? Should they be cleared?

ENVIRONMENT

PERL_RUN_DEBUG is used to set debugging flag.

NOTES

open FH, ">&=FH1" creates a "naughty" copy of FH1. Closing FH will invalidate FH1.

SEE ALSO

perl(1).