Compare commits
No commits in common. "pristine-tar" and "master" have entirely different histories.
pristine-t
...
master
5
MANIFEST
Normal file
5
MANIFEST
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
MANIFEST
|
||||||
|
Makefile.PL
|
||||||
|
README
|
||||||
|
lib/Proc/Forkfunc.pm
|
||||||
|
t/fork.t
|
9
Makefile.PL
Normal file
9
Makefile.PL
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
use ExtUtils::MakeMaker;
|
||||||
|
|
||||||
|
WriteMakefile(
|
||||||
|
'VERSION' => 96.042201,
|
||||||
|
'NAME' => 'Proc::Forkfunc',
|
||||||
|
'dist' => { COMPRESS=>"gzip", SUFFIX=>"gz" },
|
||||||
|
);
|
||||||
|
|
11
README
Normal file
11
README
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
This is a simple wrapper for fork. It will wait for there
|
||||||
|
to be a process available. It will fork off a perl function.
|
||||||
|
|
||||||
|
To build/install it, use
|
||||||
|
|
||||||
|
perl Makefile.PL
|
||||||
|
make
|
||||||
|
make test
|
||||||
|
make install
|
||||||
|
|
5
debian/changelog
vendored
Normal file
5
debian/changelog
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
libproc-forkfunc-perl (96.042201-1) unstable; urgency=low
|
||||||
|
|
||||||
|
* Initial Release.
|
||||||
|
|
||||||
|
-- Mario Fetka <mario.fetka@gmail.com> Fri, 15 Sep 2017 13:51:55 +0200
|
1
debian/compat
vendored
Normal file
1
debian/compat
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
9
|
19
debian/control
vendored
Normal file
19
debian/control
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
Source: libproc-forkfunc-perl
|
||||||
|
Section: perl
|
||||||
|
Priority: optional
|
||||||
|
Maintainer: Mario Fetka <mario.fetka@gmail.com>
|
||||||
|
Build-Depends: debhelper (>= 9)
|
||||||
|
Build-Depends-Indep: perl
|
||||||
|
Standards-Version: 3.9.6
|
||||||
|
Homepage: https://metacpan.org/release/Proc-Forkfunc
|
||||||
|
|
||||||
|
Package: libproc-forkfunc-perl
|
||||||
|
Architecture: all
|
||||||
|
Depends: ${misc:Depends}, ${perl:Depends}
|
||||||
|
Description: Proc::Forkfunk -- fork off a function
|
||||||
|
Fork off a process. Call a function on the child process the function should
|
||||||
|
be passed in as a reference. The child function should not return.
|
||||||
|
.
|
||||||
|
Logic copied from somewhere, probably Larry Wall.
|
||||||
|
.
|
||||||
|
This description was automagically extracted from the module by dh-make-perl.
|
36
debian/copyright
vendored
Normal file
36
debian/copyright
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||||
|
Source: https://metacpan.org/release/Proc-Forkfunc
|
||||||
|
Upstream-Contact: David Muir Sharnoff <muir@idiom.com>
|
||||||
|
Upstream-Name: Proc-Forkfunc
|
||||||
|
DISCLAIMER: This copyright info was automatically extracted
|
||||||
|
from the perl module. It may not be accurate, so you better
|
||||||
|
check the module sources in order to ensure the module for its
|
||||||
|
inclusion in Debian or for general legal information. Please,
|
||||||
|
if licensing information is incorrectly generated, file a bug
|
||||||
|
on dh-make-perl.
|
||||||
|
NOTE: Don't forget to remove this disclaimer once you are happy
|
||||||
|
with this file.
|
||||||
|
|
||||||
|
Files: *
|
||||||
|
Copyright: David Muir Sharnoff <muir@idiom.com>
|
||||||
|
License:
|
||||||
|
|
||||||
|
Files: debian/*
|
||||||
|
Copyright: 2017, Mario Fetka <mario.fetka@gmail.com>
|
||||||
|
License: Artistic or GPL-1+
|
||||||
|
|
||||||
|
License: Artistic
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the Artistic License, which comes with Perl.
|
||||||
|
.
|
||||||
|
On Debian systems, the complete text of the Artistic License can be
|
||||||
|
found in `/usr/share/common-licenses/Artistic'.
|
||||||
|
|
||||||
|
License: GPL-1+
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 1, or (at your option)
|
||||||
|
any later version.
|
||||||
|
.
|
||||||
|
On Debian systems, the complete text of version 1 of the GNU General
|
||||||
|
Public License can be found in `/usr/share/common-licenses/GPL-1'.
|
4
debian/rules
vendored
Executable file
4
debian/rules
vendored
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/make -f
|
||||||
|
|
||||||
|
%:
|
||||||
|
dh $@
|
1
debian/source/format
vendored
Normal file
1
debian/source/format
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
3.0 (quilt)
|
2
debian/watch
vendored
Normal file
2
debian/watch
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
version=3
|
||||||
|
https://metacpan.org/release/Proc-Forkfunc .*/Proc-Forkfunc-v?(\d[\d.-]*)\.(?:tar(?:\.gz|\.bz2)?|tgz|zip)$
|
67
lib/Proc/Forkfunc.pm
Normal file
67
lib/Proc/Forkfunc.pm
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
|
||||||
|
package Proc::Forkfunc;
|
||||||
|
|
||||||
|
require Exporter;
|
||||||
|
require POSIX;
|
||||||
|
use Carp;
|
||||||
|
|
||||||
|
@ISA = (Exporter);
|
||||||
|
@EXPORT = qw(forkfunc);
|
||||||
|
|
||||||
|
use vars qw($VERSION);
|
||||||
|
$VERSION = 96.041701;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
sub forkfunc
|
||||||
|
{
|
||||||
|
my ($func, @args) = @_;
|
||||||
|
|
||||||
|
my $pid;
|
||||||
|
|
||||||
|
{
|
||||||
|
if ($pid = fork()) {
|
||||||
|
# parent
|
||||||
|
return $pid;
|
||||||
|
} elsif (defined $pid) {
|
||||||
|
# child
|
||||||
|
&$func(@args);
|
||||||
|
croak "call to child returned\n";
|
||||||
|
} elsif ($! == &POSIX::EAGAIN) {
|
||||||
|
my $o0 = $0;
|
||||||
|
$0 = "$o0: waiting to fork";
|
||||||
|
sleep 5;
|
||||||
|
$0 = $o0;
|
||||||
|
redo;
|
||||||
|
} else {
|
||||||
|
croak "Can't fork: $!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
Proc::Forkfunk -- fork off a function
|
||||||
|
|
||||||
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
|
use Proc::Forkfunc;
|
||||||
|
|
||||||
|
forkfunc(\&child_func,@child_args);
|
||||||
|
|
||||||
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
|
Fork off a process. Call a function on the child process
|
||||||
|
the function should be passed in as a reference.
|
||||||
|
The child function should not return.
|
||||||
|
|
||||||
|
Logic copied from somewhere, probably Larry Wall.
|
||||||
|
|
||||||
|
=head1 AUTHOR
|
||||||
|
|
||||||
|
David Muir Sharnoff <muir@idiom.com>
|
||||||
|
|
Binary file not shown.
@ -1 +0,0 @@
|
|||||||
8c7b6bc3eff65e684c106849f23ab28d65d22b3b
|
|
43
t/fork.t
Executable file
43
t/fork.t
Executable file
@ -0,0 +1,43 @@
|
|||||||
|
#!/usr/local/bin/perl -w
|
||||||
|
|
||||||
|
$| = 1;
|
||||||
|
|
||||||
|
print "1..4\n";
|
||||||
|
|
||||||
|
use Proc::Forkfunc;
|
||||||
|
|
||||||
|
forkfunc(sub { exit 1} );
|
||||||
|
|
||||||
|
&wok(1);
|
||||||
|
|
||||||
|
forkfunc(sub { exit $_[0] }, 2);
|
||||||
|
|
||||||
|
&wok(2);
|
||||||
|
|
||||||
|
forkfunc(\&pok3);
|
||||||
|
|
||||||
|
&wok(3);
|
||||||
|
|
||||||
|
forkfunc(\&pok, 4);
|
||||||
|
|
||||||
|
&wok(4);
|
||||||
|
|
||||||
|
sub pok3
|
||||||
|
{
|
||||||
|
exit 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub pok
|
||||||
|
{
|
||||||
|
exit $_[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
sub wok
|
||||||
|
{
|
||||||
|
my ($ws) = @_;
|
||||||
|
|
||||||
|
wait();
|
||||||
|
my $st = $? >> 8;
|
||||||
|
|
||||||
|
print($st == $ws ? "ok $ws\n" : "not ok $ws\n");
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user