[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [leafnode-list] suggestion for next version....
Russell J. Romano wrote:
> My problem is that my scripts are written in perl. Perl can not (easily)
> run a program like fetchnews and then continue onto the next line of code.
I am not a perl expert, but you would probably have to use the fork()
command. The following is copied almost verbatim from the "Camel Book"
(Larry Wall, Tom Christiansen & Randal L. Schwartz, Programming Perl,
O'Reilly, 2nd edition, 1996).
FORK: {
if ($pid = fork) {
# continue parent process
# pid of child process is in $pid
} elsif (defined $pid) {
exec "fetchnews -vv"
# not reached
} elsif ($! =~ /No more process/) {
# EAGAIN, supposedly recoverable fork error
sleep 5;
redo FORK;
} else {
# weird fork error
die "Can't fork: $!\n"
}
}
(Disclaimer: I have not tried this.)
--Cornelius.
--
/* Cornelius Krasel, U Wuerzburg, Dept. of Pharmacology, Versbacher Str. 9 */
/* D-97078 Wuerzburg, Germany email: phak004@xxxxxxxxxxxxxxxxxxxxxx SP4 */
/* "Science is the game we play with God to find out what His rules are." */
--
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list