[libchild-perl] 01/06: Imported Upstream version 0.010

gregor herrmann gregoa at debian.org
Sat May 3 13:26:14 UTC 2014


This is an automated email from the git hooks/post-receive script.

gregoa pushed a commit to branch master
in repository libchild-perl.

commit fd3c741da3eb235f4adb1986c74b8f7367e7ee2b
Author: gregor herrmann <gregoa at debian.org>
Date:   Sat May 3 15:18:52 2014 +0200

    Imported Upstream version 0.010
---
 Build.PL                          |  1 +
 Changes                           |  3 ++
 MANIFEST                          |  5 ++-
 META.json                         | 83 +++++++++++++++++++++++++++++++++++++++
 META.yml                          | 19 +++++++--
 README                            |  8 ++--
 lib/Child.pm                      | 18 ++++++---
 lib/Child/IPC/Pipe.pm             |  2 +-
 lib/Child/Link.pm                 |  2 +-
 lib/Child/Link/IPC.pm             |  4 +-
 lib/Child/Link/IPC/Pipe.pm        |  2 +-
 lib/Child/Link/IPC/Pipe/Parent.pm |  2 +-
 lib/Child/Link/IPC/Pipe/Proc.pm   |  2 +-
 lib/Child/Link/Parent.pm          |  2 +-
 lib/Child/Link/Proc.pm            |  8 ++--
 lib/Child/Util.pm                 |  2 +-
 t/die.t                           | 54 +++++++++++++++++++++++++
 17 files changed, 189 insertions(+), 28 deletions(-)

diff --git a/Build.PL b/Build.PL
index c080401..9c147d0 100644
--- a/Build.PL
+++ b/Build.PL
@@ -16,6 +16,7 @@ my $build = Module::Build->new(
     },
     build_requires => {
         'Test::More'      => 0.88,
+        'Capture::Tiny'   => 0.22,
     },
     meta_merge => {
         resources => {
diff --git a/Changes b/Changes
new file mode 100644
index 0000000..5ece36e
--- /dev/null
+++ b/Changes
@@ -0,0 +1,3 @@
+
+
+  - Processes created by fork will have negative pids on Windows (CHORNY)
\ No newline at end of file
diff --git a/MANIFEST b/MANIFEST
index f62eaef..6819289 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,4 +1,5 @@
 Build.PL
+Changes
 lib/Child.pm
 lib/Child/IPC/Pipe.pm
 lib/Child/Link.pm
@@ -10,8 +11,10 @@ lib/Child/Link/Parent.pm
 lib/Child/Link/Proc.pm
 lib/Child/Util.pm
 MANIFEST			This list of files
-META.yml
 README
 t/Child.t
+t/die.t
 t/Import.t
 t/Manage.t
+META.yml
+META.json
diff --git a/META.json b/META.json
new file mode 100644
index 0000000..d82c8de
--- /dev/null
+++ b/META.json
@@ -0,0 +1,83 @@
+{
+   "abstract" : "Object oriented simple interface to fork()",
+   "author" : [
+      "Chad Granum <exodist7 at gmail.com>"
+   ],
+   "dynamic_config" : 1,
+   "generated_by" : "Module::Build version 0.4205",
+   "license" : [
+      "perl_5"
+   ],
+   "meta-spec" : {
+      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+      "version" : "2"
+   },
+   "name" : "Child",
+   "prereqs" : {
+      "build" : {
+         "requires" : {
+            "Capture::Tiny" : "0.22",
+            "Test::More" : "0.88"
+         }
+      },
+      "configure" : {
+         "requires" : {
+            "Module::Build" : "0.42"
+         }
+      },
+      "runtime" : {
+         "requires" : {
+            "Exporter" : "5.57",
+            "POSIX" : "0",
+            "perl" : "5.006"
+         }
+      }
+   },
+   "provides" : {
+      "Child" : {
+         "file" : "lib/Child.pm",
+         "version" : "0.010"
+      },
+      "Child::IPC::Pipe" : {
+         "file" : "lib/Child/IPC/Pipe.pm"
+      },
+      "Child::Link" : {
+         "file" : "lib/Child/Link.pm"
+      },
+      "Child::Link::IPC" : {
+         "file" : "lib/Child/Link/IPC.pm"
+      },
+      "Child::Link::IPC::Pipe" : {
+         "file" : "lib/Child/Link/IPC/Pipe.pm"
+      },
+      "Child::Link::IPC::Pipe::Parent" : {
+         "file" : "lib/Child/Link/IPC/Pipe/Parent.pm"
+      },
+      "Child::Link::IPC::Pipe::Proc" : {
+         "file" : "lib/Child/Link/IPC/Pipe/Proc.pm"
+      },
+      "Child::Link::Parent" : {
+         "file" : "lib/Child/Link/Parent.pm"
+      },
+      "Child::Link::Proc" : {
+         "file" : "lib/Child/Link/Proc.pm"
+      },
+      "Child::Util" : {
+         "file" : "lib/Child/Util.pm"
+      }
+   },
+   "release_status" : "stable",
+   "resources" : {
+      "bugtracker" : {
+         "web" : "http://github.com/exodist/Child/issues"
+      },
+      "homepage" : "http://open-exodus.net/projects/child",
+      "license" : [
+         "http://dev.perl.org/licenses/"
+      ],
+      "repository" : {
+         "url" : "http://github.com/exodist/Child"
+      }
+   },
+   "version" : "0.010"
+}
diff --git a/META.yml b/META.yml
index 54e9151..61662fa 100644
--- a/META.yml
+++ b/META.yml
@@ -3,10 +3,12 @@ abstract: 'Object oriented simple interface to fork()'
 author:
   - 'Chad Granum <exodist7 at gmail.com>'
 build_requires:
+  Capture::Tiny: 0.22
   Test::More: 0.88
 configure_requires:
-  Module::Build: 0.36
-generated_by: 'Module::Build version 0.3607'
+  Module::Build: 0.42
+dynamic_config: 1
+generated_by: 'Module::Build version 0.4205, CPAN::Meta::Converter version 2.120921'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -15,25 +17,34 @@ name: Child
 provides:
   Child:
     file: lib/Child.pm
-    version: 0.009
+    version: 0.010
   Child::IPC::Pipe:
     file: lib/Child/IPC/Pipe.pm
+    version: 0
   Child::Link:
     file: lib/Child/Link.pm
+    version: 0
   Child::Link::IPC:
     file: lib/Child/Link/IPC.pm
+    version: 0
   Child::Link::IPC::Pipe:
     file: lib/Child/Link/IPC/Pipe.pm
+    version: 0
   Child::Link::IPC::Pipe::Parent:
     file: lib/Child/Link/IPC/Pipe/Parent.pm
+    version: 0
   Child::Link::IPC::Pipe::Proc:
     file: lib/Child/Link/IPC/Pipe/Proc.pm
+    version: 0
   Child::Link::Parent:
     file: lib/Child/Link/Parent.pm
+    version: 0
   Child::Link::Proc:
     file: lib/Child/Link/Proc.pm
+    version: 0
   Child::Util:
     file: lib/Child/Util.pm
+    version: 0
 requires:
   Exporter: 5.57
   POSIX: 0
@@ -43,4 +54,4 @@ resources:
   homepage: http://open-exodus.net/projects/child
   license: http://dev.perl.org/licenses/
   repository: http://github.com/exodist/Child
-version: 0.009
+version: 0.010
diff --git a/README b/README
index ec17399..08e8c76 100644
--- a/README
+++ b/README
@@ -24,10 +24,10 @@ SYNOPSIS
             ....
             # exit() is called for you at the end.
         });
-        my $proc = $child->start
+        my $proc = $child->start;
 
         # Kill the child if it is not done
-        $proc->complete || $proc->kill(9);
+        $proc->is_complete || $proc->kill(9);
 
         $proc->wait; #blocking
 
@@ -113,7 +113,7 @@ SEE ALSO
         The proc object that is returned by $child->start()
 
     Child::Link::Parent
-        The parent object that is provided as the argumunt to the function
+        The parent object that is provided as the argument to the function
         used to define the child.
 
     Child::Link::IPC
@@ -132,7 +132,7 @@ FENNEC PROJECT
     a potent testing environment.
 
     The tools provided by Fennec are also useful on their own. Sometimes a
-    tool created for Fennec is useful outside the greator framework. Such
+    tool created for Fennec is useful outside the greater framework. Such
     tools are turned into their own projects. This is one such project.
 
     Fennec - The core framework
diff --git a/lib/Child.pm b/lib/Child.pm
index 56238be..3faca4d 100644
--- a/lib/Child.pm
+++ b/lib/Child.pm
@@ -9,7 +9,7 @@ use Child::Link::Parent;
 
 use Exporter 'import';
 
-our $VERSION = "0.009";
+our $VERSION = "0.010";
 our @PROCS;
 our @EXPORT_OK = qw/child/;
 
@@ -68,7 +68,13 @@ sub start {
     @PROCS = ();
     my $parent = $self->parent_class->new( $ppid, @data );
     my $code = $self->code;
-    $code->( $parent );
+
+    # Ensure the child code can't die and jump out of our control.
+    eval { $code->( $parent ); 1; } || do {
+        # Simulate die without dying.
+        print STDERR $@;
+        exit 255;
+    };
     exit;
 }
 
@@ -105,10 +111,10 @@ signal to the parent as well as the child.
         ....
         # exit() is called for you at the end.
     });
-    my $proc = $child->start
+    my $proc = $child->start;
 
     # Kill the child if it is not done
-    $proc->complete || $proc->kill(9);
+    $proc->is_complete || $proc->kill(9);
 
     $proc->wait; #blocking
 
@@ -231,7 +237,7 @@ The proc object that is returned by $child->start()
 
 =item L<Child::Link::Parent>
 
-The parent object that is provided as the argumunt to the function used to
+The parent object that is provided as the argument to the function used to
 define the child.
 
 =item L<Child::Link::IPC>
@@ -253,7 +259,7 @@ Together the tools that make up the Fennec framework provide a potent testing
 environment.
 
 The tools provided by Fennec are also useful on their own. Sometimes a tool
-created for Fennec is useful outside the greator framework. Such tools are
+created for Fennec is useful outside the greater framework. Such tools are
 turned into their own projects. This is one such project.
 
 =over 2
diff --git a/lib/Child/IPC/Pipe.pm b/lib/Child/IPC/Pipe.pm
index 34262bd..1c4cffe 100644
--- a/lib/Child/IPC/Pipe.pm
+++ b/lib/Child/IPC/Pipe.pm
@@ -47,7 +47,7 @@ Together the tools that make up the Fennec framework provide a potent testing
 environment.
 
 The tools provided by Fennec are also useful on their own. Sometimes a tool
-created for Fennec is useful outside the greator framework. Such tools are
+created for Fennec is useful outside the greater framework. Such tools are
 turned into their own projects. This is one such project.
 
 =over 2
diff --git a/lib/Child/Link.pm b/lib/Child/Link.pm
index 4c40d61..ddad645 100644
--- a/lib/Child/Link.pm
+++ b/lib/Child/Link.pm
@@ -42,7 +42,7 @@ Together the tools that make up the Fennec framework provide a potent testing
 environment.
 
 The tools provided by Fennec are also useful on their own. Sometimes a tool
-created for Fennec is useful outside the greator framework. Such tools are
+created for Fennec is useful outside the greater framework. Such tools are
 turned into their own projects. This is one such project.
 
 =over 2
diff --git a/lib/Child/Link/IPC.pm b/lib/Child/Link/IPC.pm
index a8c4e88..69d0290 100644
--- a/lib/Child/Link/IPC.pm
+++ b/lib/Child/Link/IPC.pm
@@ -95,7 +95,7 @@ Send the messages to the child. works like print, you must add "\n".
 
 =item $proc->say( @MESSAGES )
 
-Send the messages to the child. works like say, adds the seperator for you
+Send the messages to the child. works like say, adds the separator for you
 (usually "\n").
 
 =item $proc->autoflush( $BOOL )
@@ -146,7 +146,7 @@ Together the tools that make up the Fennec framework provide a potent testing
 environment.
 
 The tools provided by Fennec are also useful on their own. Sometimes a tool
-created for Fennec is useful outside the greator framework. Such tools are
+created for Fennec is useful outside the greater framework. Such tools are
 turned into their own projects. This is one such project.
 
 =over 2
diff --git a/lib/Child/Link/IPC/Pipe.pm b/lib/Child/Link/IPC/Pipe.pm
index 47a6324..923ba8c 100644
--- a/lib/Child/Link/IPC/Pipe.pm
+++ b/lib/Child/Link/IPC/Pipe.pm
@@ -57,7 +57,7 @@ Together the tools that make up the Fennec framework provide a potent testing
 environment.
 
 The tools provided by Fennec are also useful on their own. Sometimes a tool
-created for Fennec is useful outside the greator framework. Such tools are
+created for Fennec is useful outside the greater framework. Such tools are
 turned into their own projects. This is one such project.
 
 =over 2
diff --git a/lib/Child/Link/IPC/Pipe/Parent.pm b/lib/Child/Link/IPC/Pipe/Parent.pm
index 963ae08..bf1f4ce 100644
--- a/lib/Child/Link/IPC/Pipe/Parent.pm
+++ b/lib/Child/Link/IPC/Pipe/Parent.pm
@@ -44,7 +44,7 @@ Together the tools that make up the Fennec framework provide a potent testing
 environment.
 
 The tools provided by Fennec are also useful on their own. Sometimes a tool
-created for Fennec is useful outside the greator framework. Such tools are
+created for Fennec is useful outside the greater framework. Such tools are
 turned into their own projects. This is one such project.
 
 =over 2
diff --git a/lib/Child/Link/IPC/Pipe/Proc.pm b/lib/Child/Link/IPC/Pipe/Proc.pm
index e930faa..21a0529 100644
--- a/lib/Child/Link/IPC/Pipe/Proc.pm
+++ b/lib/Child/Link/IPC/Pipe/Proc.pm
@@ -44,7 +44,7 @@ Together the tools that make up the Fennec framework provide a potent testing
 environment.
 
 The tools provided by Fennec are also useful on their own. Sometimes a tool
-created for Fennec is useful outside the greator framework. Such tools are
+created for Fennec is useful outside the greater framework. Such tools are
 turned into their own projects. This is one such project.
 
 =over 2
diff --git a/lib/Child/Link/Parent.pm b/lib/Child/Link/Parent.pm
index 22f2225..8a166ad 100644
--- a/lib/Child/Link/Parent.pm
+++ b/lib/Child/Link/Parent.pm
@@ -58,7 +58,7 @@ Together the tools that make up the Fennec framework provide a potent testing
 environment.
 
 The tools provided by Fennec are also useful on their own. Sometimes a tool
-created for Fennec is useful outside the greator framework. Such tools are
+created for Fennec is useful outside the greater framework. Such tools are
 turned into their own projects. This is one such project.
 
 =over 2
diff --git a/lib/Child/Link/Proc.pm b/lib/Child/Link/Proc.pm
index 9c2e39c..e9bef05 100644
--- a/lib/Child/Link/Proc.pm
+++ b/lib/Child/Link/Proc.pm
@@ -111,14 +111,14 @@ Returns the process PID.
 Will be undef unless the process has exited, otherwise it will have the exit
 status.
 
-B<Note>: When you call exit($N) the actual unix exit status will be bit shifed
+B<Note>: When you call exit($N) the actual unix exit status will be bit shifted
 with extra information added. exit_status() will shift the value back for you.
-That means exit_status() will return 2 whun your child calls exit(2) see
+That means exit_status() will return 2 when your child calls exit(2) see
 unix_exit() if you want the actual value wait() assigned to $?.
 
 =item $proc->unix_exit()
 
-When you call exit($N) the actual unix exit status will be bit shifed
+When you call exit($N) the actual unix exit status will be bit shifted
 with extra information added. See exit_status() if you want the actual value
 used in exit() in the child.
 
@@ -137,7 +137,7 @@ Together the tools that make up the Fennec framework provide a potent testing
 environment.
 
 The tools provided by Fennec are also useful on their own. Sometimes a tool
-created for Fennec is useful outside the greator framework. Such tools are
+created for Fennec is useful outside the greater framework. Such tools are
 turned into their own projects. This is one such project.
 
 =over 2
diff --git a/lib/Child/Util.pm b/lib/Child/Util.pm
index 4110f63..5cf525e 100644
--- a/lib/Child/Util.pm
+++ b/lib/Child/Util.pm
@@ -61,7 +61,7 @@ Together the tools that make up the Fennec framework provide a potent testing
 environment.
 
 The tools provided by Fennec are also useful on their own. Sometimes a tool
-created for Fennec is useful outside the greator framework. Such tools are
+created for Fennec is useful outside the greater framework. Such tools are
 turned into their own projects. This is one such project.
 
 =over 2
diff --git a/t/die.t b/t/die.t
new file mode 100644
index 0000000..438d3d8
--- /dev/null
+++ b/t/die.t
@@ -0,0 +1,54 @@
+#!/usr/bin/perl;
+use strict;
+use warnings;
+
+use Test::More 0.88;
+use Capture::Tiny qw(capture_stderr);
+our $CLASS = 'Child';
+
+require_ok( $CLASS );
+
+note "die in child"; {
+    my $pid = $$;
+
+    is capture_stderr {
+        my $child = Child->new(sub { die "Foo\n" });
+        my $proc = $child->start;
+        $proc->wait;
+        is $proc->exit_status, 255;
+    }, "Foo\n";
+
+    is $pid, $$, "didn't leak out of the child process";
+}
+
+note "Child in eval"; {
+    my $pid = $$;
+
+    is capture_stderr {
+        eval {
+            my $child = Child->new(sub { die "Foo\n" });
+            my $proc = $child->start;
+            $proc->wait;
+            is $proc->exit_status, 255;
+        };
+        is $@, '', "child death does not affect parent \$@";
+    }, "Foo\n";
+
+    is $pid, $$, "didn't leak out of the child process";
+};
+
+
+note "Function returning false isn't confused with dying"; {
+    my $pid = $$;
+
+    is capture_stderr {
+        my $child = Child->new(sub { return });
+        my $proc = $child->start;
+        $proc->wait;
+        is $proc->exit_status, 0;
+    }, "";
+
+    is $pid, $$, "didn't leak out of the child process";
+};
+
+done_testing;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libchild-perl.git



More information about the Pkg-perl-cvs-commits mailing list