Dpkg::IPC(3perl)
π Dpkg::IPC β helper functions for IPC π¦
okay so bestie, this is libdpkg-perl's Dpkg::IPC(3perl) page and honestly? it's lowkey iconic. it's the module that lets you run other programs from Perl in an easy-but-flexible way, while it hides all the gory, messy, gross details of IPC (that's Inter-Process Communication π«Ά) so you don't have to look at them. not me being grateful for that fr fr.
β¨ DESCRIPTION β¨
Dpkg::IPC hands you helper functions that let you execute other programs in an easy, yet flexible way β and it hides all the gory details of IPC (Inter-Process Communication) from you. you get to be the main character who just runs programs; the module handles the icky plumbing. π
πΈ FUNCTIONS πΈ
$pid = spawn(%opts)
creates a child process and executes another program inside it. the arguments are interpreted as a hash of options that say how to handle the in and output of the program you're executing. returns the pid of the child process β unless the wait_child option was given, in which case, different story, keep reading. π
any error will cause the function to exit with one of the Dpkg::ErrorHandling functions. so like, it does not just politely return undef. it exits. π
π Options:
exec(required) β can be either a scalar, i.e. the name of the program to be executed, or an array reference, i.e. the name of the program plus additional arguments. note that the program will never be executed via the shell, so you can't specify additional arguments in the scalar string and you can't use any shell facilities like globbing. no globbing bestie, sorry πfrom_file,to_file,error_to_fileβ filename as scalar. standard input/output/error of the child process will be redirected to the file specified.from_handle,to_handle,error_to_handleβ filehandle. standard input/output/error of the child process will be dup'ed from the handle.from_pipe,to_pipe,error_to_pipeβ scalar reference or object based onIO::Handle. a pipe will be opened for each of the two options and either the reading (to_pipeanderror_to_pipe) or the writing end (from_pipe) will be returned in the referenced scalar. standard input/output/error of the child process will be dup'ed to the other ends of the pipes.from_string,to_string,error_to_stringβ scalar reference. standard input/output/error of the child process will be redirected to the string given as reference. note that it wouldn't be strictly necessary to use a scalar reference forfrom_string, as the string is not modified in any way β that was chosen only for reasons of symmetry withto_stringanderror_to_string.to_stringanderror_to_stringimply thewait_childoption. π«Άwait_childβ scalar. if containing a true value,wait_child()will be called before returning. the return value ofspawn()will be a true value, not the pid. heads up!no_checkβ scalar. option of thewait_child()call.nocheckβ deprecated alias forno_check. it emits a deprecation warning, but if it is required for backwards compatibility it can be passed alongsideno_checkand the warning will not be emitted. πtimeoutβ scalar. option of thewait_child()call.chdirβ scalar. the child process willchdirin the indicated directory before callingexec.envβ hash reference. the child process will populate%ENVwith the items of the hash before callingexec. this allows exporting environment variables. β¨delete_envβ array reference. the child process will remove all environment variables listed in the array before callingexec.sigβ hash reference. the child process will populate%SIGwith the items of the hash before callingexec. this allows setting signal dispositions.delete_sigβ array reference. the child process will reset all signals listed in the array to their default dispositions before callingexec.
wait_child($pid, %opts)
takes as first argument the pid of the process to wait for. remaining arguments are taken as a hash of options. returns nothing. fails if the child has been ended by a signal or if it exited non-zero. π€
π Options:
cmdlineβ string to identify the child process in error messages. defaults to"child process".no_checkβ if true, do not check the return status of the child (and thus do not fail if it has been killed or if it exited with a non-zero return code).nocheckβ deprecated alias forno_check. it emits a deprecation warning, but if it is required for backwards compatibility it can be passed alongsideno_checkand the warning will not be emitted. πtimeoutβ set a maximum time to wait for the process, after that kill the process and fail with an error message. dramatic but necessary π₯
π CHANGES π
Version 1.03 (dpkg 1.23.0) β
- New options:
spawn()andwait_child()now accept'no_check'. - Deprecated options:
'nocheck'inspawn()andwait_child().
Version 1.02 (dpkg 1.18.0) πΈ
- Change options:
wait_child()now kills the process when reaching the'timeout'.
Version 1.01 (dpkg 1.17.11) π¦
- New options:
spawn()now accepts'sig'and'delete_sig'.
Version 1.00 (dpkg 1.15.6) π
- Mark the module as public.
π SEE ALSO π
Dpkg, Dpkg::ErrorHandling.
k that's the whole page bestie, go forth and spawn responsibly π«Ά
okay and like, the little footer said 1.23.11-dirty dated 2026-09-09 β slay, that's the version and date, bye ππ§ββοΈ
π¦ where this page comes from
- arch rolling: dpkg 1.23.11-1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms