r74888 - in /branches/upstream/libproc-daemon-perl/current: Changes MANIFEST META.yml lib/Proc/Daemon.pm lib/Proc/Daemon.pod
carnil at users.alioth.debian.org
carnil at users.alioth.debian.org
Thu May 26 21:02:11 UTC 2011
Author: carnil
Date: Thu May 26 21:01:37 2011
New Revision: 74888
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=74888
Log:
[svn-upgrade] new version libproc-daemon-perl (0.12)
Modified:
branches/upstream/libproc-daemon-perl/current/Changes
branches/upstream/libproc-daemon-perl/current/MANIFEST
branches/upstream/libproc-daemon-perl/current/META.yml
branches/upstream/libproc-daemon-perl/current/lib/Proc/Daemon.pm
branches/upstream/libproc-daemon-perl/current/lib/Proc/Daemon.pod
Modified: branches/upstream/libproc-daemon-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libproc-daemon-perl/current/Changes?rev=74888&op=diff
==============================================================================
--- branches/upstream/libproc-daemon-perl/current/Changes (original)
+++ branches/upstream/libproc-daemon-perl/current/Changes Thu May 26 21:01:37 2011
@@ -1,4 +1,9 @@
Revision history for Perl module Proc::Daemon.
+
+0.12 Tue Mai 24 2011
+ - Init() did not close all filehandles reliably in some cases. Thanks again
+ to Rob Brown for reporting.
+ - Text improvement in the documentation.
0.11 Mon Mai 23 2011
- Init() didn't close all filehandles reliably (see also bug report at
Modified: branches/upstream/libproc-daemon-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libproc-daemon-perl/current/MANIFEST?rev=74888&op=diff
==============================================================================
--- branches/upstream/libproc-daemon-perl/current/MANIFEST (original)
+++ branches/upstream/libproc-daemon-perl/current/MANIFEST Thu May 26 21:01:37 2011
@@ -1,9 +1,9 @@
-Changes
-lib/Proc/Daemon.pm
-lib/Proc/Daemon.pod
-Makefile.PL
-MANIFEST
-README
-t/01_loadmodule.t
-t/02_testmodule.t
+Changes
+lib/Proc/Daemon.pm
+lib/Proc/Daemon.pod
+Makefile.PL
+MANIFEST
+README
+t/01_loadmodule.t
+t/02_testmodule.t
META.yml Module meta-data (added by MakeMaker)
Modified: branches/upstream/libproc-daemon-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libproc-daemon-perl/current/META.yml?rev=74888&op=diff
==============================================================================
--- branches/upstream/libproc-daemon-perl/current/META.yml (original)
+++ branches/upstream/libproc-daemon-perl/current/META.yml Thu May 26 21:01:37 2011
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Proc-Daemon
-version: 0.11
+version: 0.12
abstract: ~
license: perl
author:
Modified: branches/upstream/libproc-daemon-perl/current/lib/Proc/Daemon.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libproc-daemon-perl/current/lib/Proc/Daemon.pm?rev=74888&op=diff
==============================================================================
--- branches/upstream/libproc-daemon-perl/current/lib/Proc/Daemon.pm (original)
+++ branches/upstream/libproc-daemon-perl/current/lib/Proc/Daemon.pm Thu May 26 21:01:37 2011
@@ -21,7 +21,7 @@
use strict;
use POSIX();
-$Proc::Daemon::VERSION = '0.11';
+$Proc::Daemon::VERSION = '0.12';
my %memory;
@@ -214,14 +214,14 @@
# Close all file handles and descriptors the user does not want
# to preserve.
- my $count;
+ my $hc_fd; # highest closed file descriptor
close $FH_MEMORY;
foreach ( 0 .. OpenMax() ) {
unless ( $dont_close_fd{ $_ } ) {
if ( $_ == 0 ) { close STDIN }
elsif ( $_ == 1 ) { close STDOUT }
elsif ( $_ == 2 ) { close STDERR }
- else { $count++ if POSIX::close( $_ ) }
+ else { $hc_fd = $_ if POSIX::close( $_ ) }
}
}
@@ -240,9 +240,9 @@
# handles associated with one file, what can cause some
# confusion. :-)
# see: http://rt.perl.org/rt3/Ticket/Display.html?id=72526
- if ( $count ) {
+ if ( $hc_fd ) {
my @fh;
- foreach ( 1 .. $count ) { open $fh[ $_ ], "</dev/null" }
+ foreach ( 3 .. $hc_fd ) { open $fh[ $_ ], "</dev/null" }
# Perl will try to close all handles when @fh leaves scope
# here, but the rude ones will sacrifice themselves to avoid
# potential damage later.
@@ -262,6 +262,7 @@
# Return the childs own PID (= 0)
return $pid;
}
+
# First child (= second parent) runs here.
@@ -303,6 +304,7 @@
# Only first parent runs here.
+
# Exit if the context is looking for no value (void context).
exit 0 unless defined wantarray;
Modified: branches/upstream/libproc-daemon-perl/current/lib/Proc/Daemon.pod
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libproc-daemon-perl/current/lib/Proc/Daemon.pod?rev=74888&op=diff
==============================================================================
--- branches/upstream/libproc-daemon-perl/current/lib/Proc/Daemon.pod (original)
+++ branches/upstream/libproc-daemon-perl/current/lib/Proc/Daemon.pod Thu May 26 21:01:37 2011
@@ -98,8 +98,14 @@
=item 9
The first child transfers the PID of the second child (daemon) to the
-parent and exits. Additionally the PID of the daemon process can be written
-into a file if 'pid_file' is defined.
+parent. Additionally the PID of the daemon process can be written into a file
+if 'pid_file' is defined. Then the first child exits.
+
+
+=item 10
+
+If the parent script is looking for a return value, then the PID(s) of the
+child/ren will be returned. Otherwise the parent will exit.
=back
@@ -127,12 +133,12 @@
=item work_dir
-Defines the path to the daemon working directory. Defaults to C</>.
+Defines the path to the working directory of your daemon. Defaults to C</>.
=item child_STDIN
-Defines the path to STDIN of your daemon. Defaults to C</dev/null>. Default
+Defines the path to STDIN for your daemon. Defaults to C</dev/null>. Default
Mode is '<' (read). You can define other Mode the same way as you do using
Perls C<open> in a two-argument form.
@@ -159,7 +165,7 @@
below a C<__DATA__> token in your script or module called by C<use> or
C<require>.
- dont_close_fh => [ 'main::DATA', 'PackageName::DATA', ... ],
+ dont_close_fh => [ 'main::DATA', 'PackageName::DATA', $my_filehandle, ... ],
You can add any kind of file handle to the array (expression in single quotes or
a scalar variable), including 'STDIN', 'STDOUT' and 'STDERR'. Logically the path
@@ -177,7 +183,7 @@
=item pid_file
-Defines the path to the file where the PID of the child process is
+Defines the path to a file where the PID of the daemon process will be
stored. Defaults to C<undef> (= write no file).
@@ -245,9 +251,9 @@
If you want to use the object reference created by C<new> for other daemons,
you write C<Init( { %ARGS } )>. %ARGS are the same as described in
-C<new>. Notice that you shouldn't call C<Init()>, or
-this next daemon will do and write all in the same files as the first daemon. At
-least use an empty anonymous hash.
+C<new>. Notice that you shouldn't call C<Init()> without argument in this case,
+or the next daemon will execute and/or write in the same files as the first
+daemon. To prevent this use at least an empty anonymous hash here.
$pid = $daemon->Init( {} );
@pid = $daemon->Init( {
@@ -258,18 +264,20 @@
If you don't need the Proc::Daemon object reference in your script, you
can also use the method without object reference:
- $pid = Proc::Daemon::Init( [ { %ARGS } ] );
-
-To the parent C<Init> returns the PID (scalar) of the daemon, or the PIDs
-(array) of the daemons created (if C<exec_command> has more then one program
-to execute). See examples above.
-
-Returns 0 to the child (daemon).
+ $pid = Proc::Daemon::Init();
+ # or
+ $pid = Proc::Daemon::Init( { %ARGS } );
+
+C<Init> returns the PID (scalar) of the daemon to the parent, or the PIDs
+(array) of the daemons created if C<exec_command> has more then one program
+to execute. See examples above.
+
+C<Init> returns 0 to the child (daemon).
If you call the C<Init> method in the context without looking for a return value
(void context) the parent process will C<exit> here like in earlier versions:
- Proc::Daemon::Init;
+ Proc::Daemon::Init();
=item Status( [ $ARG ] )
@@ -411,7 +419,7 @@
=item *
-"UNIX Network Progamming", Vol 1, by W. Richard Stevens.
+"UNIX Network Programming", Vol 1, by W. Richard Stevens.
Prentice-Hall PTR, Copyright 1998.
=back
More information about the Pkg-perl-cvs-commits
mailing list