r71393 - in /branches/upstream/libproc-daemon-perl/current: Changes META.yml lib/Proc/Daemon.pm lib/Proc/Daemon.pod

carnil at users.alioth.debian.org carnil at users.alioth.debian.org
Mon Mar 14 07:46:14 UTC 2011


Author: carnil
Date: Mon Mar 14 07:46:02 2011
New Revision: 71393

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=71393
Log:
[svn-upgrade] new version libproc-daemon-perl (0.08)

Modified:
    branches/upstream/libproc-daemon-perl/current/Changes
    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=71393&op=diff
==============================================================================
--- branches/upstream/libproc-daemon-perl/current/Changes (original)
+++ branches/upstream/libproc-daemon-perl/current/Changes Mon Mar 14 07:46:02 2011
@@ -1,4 +1,9 @@
 Revision history for Perl module Proc::Daemon.
+
+0.08  Sun Mar 13 2011
+	- The <open> Mode of the daemon file handles STDIN, STDOUT, STDERR can be
+	  specified now. The default Mode values are the same as before.
+	- Updated the documentation.
 
 0.07  Thu Feb 17 2011
 	- Add signal processing to Kill_Daemon().

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=71393&op=diff
==============================================================================
--- branches/upstream/libproc-daemon-perl/current/META.yml (original)
+++ branches/upstream/libproc-daemon-perl/current/META.yml Mon Mar 14 07:46:02 2011
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:                Proc-Daemon
-version:             0.07
+version:             0.08
 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=71393&op=diff
==============================================================================
--- branches/upstream/libproc-daemon-perl/current/lib/Proc/Daemon.pm (original)
+++ branches/upstream/libproc-daemon-perl/current/lib/Proc/Daemon.pm Mon Mar 14 07:46:02 2011
@@ -21,7 +21,7 @@
 use strict;
 use POSIX();
 
-$Proc::Daemon::VERSION = '0.07';
+$Proc::Daemon::VERSION = '0.08';
 
 
 ################################################################################
@@ -30,9 +30,9 @@
 #
 #   %Daemon_Settings are hash key=>values and can be:
 #     work_dir     => '/working/daemon/directory'   -> defaults to '/'
-#     child_STDIN  => '/path/to/daemon/STDIN.file'  -> defautls to '/dev/null'
-#     child_STDOUT => '/path/to/daemon/STDOUT.file' -> defaults to '/dev/null'
-#     child_STDERR => '/path/to/daemon/STDERR.file' -> defaults to '/dev/null'
+#     child_STDIN  => '/path/to/daemon/STDIN.file'  -> defautls to '</dev/null'
+#     child_STDOUT => '/path/to/daemon/STDOUT.file' -> defaults to '+>/dev/null'
+#     child_STDERR => '/path/to/daemon/STDERR.file' -> defaults to '+>/dev/null'
 #     pid_file =>     '/path/to/pid/file.txt'       -> defaults to
 #       undef (= write no file)
 #     exec_command => 'perl /home/script.pl'        -> execute a system command
@@ -185,9 +185,9 @@
                 # Reopen STDIN, STDOUT and STDERR to '..._path' or to /dev/null.
                 # Data written on a null special file is discarded. Reads from
                 # the null special file always return end of file.
-                open( STDIN,  "<",  $self->{child_STDIN}  || "/dev/null" );
-                open( STDOUT, "+>", $self->{child_STDOUT} || "/dev/null" );
-                open( STDERR, "+>", $self->{child_STDERR} || "/dev/null" );
+                open( STDIN,  $self->{child_STDIN}  || "</dev/null" );
+                open( STDOUT, $self->{child_STDOUT} || "+>/dev/null" );
+                open( STDERR, $self->{child_STDERR} || "+>/dev/null" );
 
 
                 # Execute a system command and never return.
@@ -270,17 +270,17 @@
     # Set default 'work_dir' if needed.
     $self->{work_dir} ||= '/';
 
-    $self->fix_filename('child_STDIN')  if $self->{child_STDIN}  && $self->{child_STDIN}  ne '/dev/null';
-
-    $self->fix_filename('child_STDOUT') if $self->{child_STDOUT} && $self->{child_STDOUT} ne '/dev/null';
-
-    $self->fix_filename('child_STDERR') if $self->{child_STDERR} && $self->{child_STDERR} ne '/dev/null';
+    $self->fix_filename( 'child_STDIN',  1 ) if $self->{child_STDIN};
+
+    $self->fix_filename( 'child_STDOUT', 1 ) if $self->{child_STDOUT};
+
+    $self->fix_filename( 'child_STDERR', 1 ) if $self->{child_STDERR};
 
     # Check 'pid_file's name
     if ( $self->{pid_file} ) {
         die "Pidfile (pid_file => '$self->{pid_file}') can not be only a number. I must be able to distinguish it from a PID number in &get_pid('...')." if $self->{pid_file} =~ /^\d+$/;
 
-        $self->fix_filename('pid_file');
+        $self->fix_filename( 'pid_file' );
     }
 
     return;
@@ -291,8 +291,10 @@
 # - If the keys value is only a filename add the path of 'work_dir'.
 # - If we have already set a file for this key with the same "path/name",
 #   add a number to the file.
-# Args: ( $self, $key )
+# Args: ( $self, $key, $extract_mode )
 #   key: one of 'child_STDIN', 'child_STDOUT', 'child_STDERR', 'pid_file'
+#   extract_mode: 1 = separate MODE form filename before checking pathname
+#                 | <undef>
 # Returns: nothing
 ################################################################################
 my %memory;
@@ -300,6 +302,11 @@
     my Proc::Daemon $self = shift;
     my $key = shift;
     my $var = $self->{ $key };
+    my $mode = '';
+    if ( shift ) {
+        $var =~ s/^([\+\<\>\-\|]+)//;
+        $mode = $1 || ( $key eq 'child_STDIN' ? '<' : '+>' );
+    }
 
     # add path to filename
     if ( $var =~ s/^\.\/// || $var !~ /\// ) {
@@ -322,7 +329,7 @@
     }
 
     $memory{ $key }{ $var } = 1;
-    $self->{ $key } = $var;
+    $self->{ $key } = $mode . $var;
 
     return;
 }

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=71393&op=diff
==============================================================================
--- branches/upstream/libproc-daemon-perl/current/lib/Proc/Daemon.pod (original)
+++ branches/upstream/libproc-daemon-perl/current/lib/Proc/Daemon.pod Mon Mar 14 07:46:02 2011
@@ -131,20 +131,23 @@
 
 =item child_STDIN
 
-Defines the path to STDIN of your daemon. Defaults to C</dev/null>. Mode is '<'
-(read).
+Defines the path to STDIN of your daemon. Defaults to C</dev/null>. Default
+Mode is '<' (read). You can set your prefered Mode as if you use Perls C<open>
+with a two-argument form.
 
 
 =item child_STDOUT
 
 Defines the path where the output of your daemon will go. Defaults to
-C</dev/null>. Mode is '+>' (write/read).
+C</dev/null>. Default Mode is '+>' (write/read). You can set your prefered Mode
+as if you use Perls C<open> with a two-argument form.
 
 
 =item child_STDERR
 
 Defines the path where the error output of your daemon will go. Defaults to
-C</dev/null>. Mode is '+>' (write/read).
+C</dev/null>. Default Mode is '+>' (write/read). You can set your prefered Mode
+as if you use Perls C<open> with a two-argument form.
 
 
 =item pid_file
@@ -167,7 +170,7 @@
     my $daemon = Proc::Daemon->new(
         work_dir     => '/working/daemon/directory',
         child_STDOUT => '/path/to/daemon/output.file',
-        child_STDERR => 'debug.txt',
+        child_STDERR => '+>>debug.txt',
         pid_file     => 'pid.txt',
         exec_command => 'perl /home/my_script.pl',
       # or:




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