r76608 - in /branches/upstream/libproc-simple-perl/current: .licensizer.yml Changes MANIFEST META.yml README Simple.pm t/mult.t
carnil at users.alioth.debian.org
carnil at users.alioth.debian.org
Mon Jun 27 07:09:46 UTC 2011
Author: carnil
Date: Mon Jun 27 07:09:36 2011
New Revision: 76608
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=76608
Log:
[svn-upgrade] new version libproc-simple-perl (1.28)
Added:
branches/upstream/libproc-simple-perl/current/.licensizer.yml
Modified:
branches/upstream/libproc-simple-perl/current/Changes
branches/upstream/libproc-simple-perl/current/MANIFEST
branches/upstream/libproc-simple-perl/current/META.yml
branches/upstream/libproc-simple-perl/current/README
branches/upstream/libproc-simple-perl/current/Simple.pm
branches/upstream/libproc-simple-perl/current/t/mult.t
Added: branches/upstream/libproc-simple-perl/current/.licensizer.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libproc-simple-perl/current/.licensizer.yml?rev=76608&op=file
==============================================================================
--- branches/upstream/libproc-simple-perl/current/.licensizer.yml (added)
+++ branches/upstream/libproc-simple-perl/current/.licensizer.yml Mon Jun 27 07:09:36 2011
@@ -1,0 +1,18 @@
+# .licensizer.yml
+
+author:
+ text: |
+ 1996, Mike Schilli <cpan at perlmeister.com>
+ header: AUTHORS
+ mode: verbatim
+
+license:
+ text: |
+ Copyright 1996-2011 by Mike Schilli, all rights reserved.
+ This program is free software, you can redistribute it and/or
+ modify it under the same terms as Perl itself.
+ header: LEGALESE
+
+path_exclude:
+ - t/
+ - blib/
Modified: branches/upstream/libproc-simple-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libproc-simple-perl/current/Changes?rev=76608&op=diff
==============================================================================
--- branches/upstream/libproc-simple-perl/current/Changes (original)
+++ branches/upstream/libproc-simple-perl/current/Changes Mon Jun 27 07:09:36 2011
@@ -1,6 +1,15 @@
######################################################################
Proc::Simple CHANGES
######################################################################
+
+ From 1.27:
+ [RT 62802] Pod fix by Salvatore Bonaccorso
+ [RT 63833] Applied patch to stop reaping PIDs of
+ no longer existing processes (submitted by perlbotics).
+ Added licensizer
+ [RT 63833] (second part) Added cleanup() class method
+ to delete timing data of reaped processes, avoiding
+ infinite memory growth on long-running processes
From 1.26: [RT 62285] Pod fix for redirect_output()
Fixed github link
Modified: branches/upstream/libproc-simple-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libproc-simple-perl/current/MANIFEST?rev=76608&op=diff
==============================================================================
--- branches/upstream/libproc-simple-perl/current/MANIFEST (original)
+++ branches/upstream/libproc-simple-perl/current/MANIFEST Mon Jun 27 07:09:36 2011
@@ -1,3 +1,4 @@
+.licensizer.yml
Changes
eg/parproc.pl
Makefile.PL
Modified: branches/upstream/libproc-simple-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libproc-simple-perl/current/META.yml?rev=76608&op=diff
==============================================================================
--- branches/upstream/libproc-simple-perl/current/META.yml (original)
+++ branches/upstream/libproc-simple-perl/current/META.yml Mon Jun 27 07:09:36 2011
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Proc-Simple
-version: 1.27
+version: 1.28
abstract: ~
author: []
license: unknown
Modified: branches/upstream/libproc-simple-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libproc-simple-perl/current/README?rev=76608&op=diff
==============================================================================
--- branches/upstream/libproc-simple-perl/current/README (original)
+++ branches/upstream/libproc-simple-perl/current/README Mon Jun 27 07:09:36 2011
@@ -1,5 +1,5 @@
######################################################################
- Proc::Simple 1.27
+ Proc::Simple 1.28
######################################################################
NAME
@@ -64,7 +64,7 @@
The *start* Method returns immediately after starting the specified
process in background, i.e. there's no blocking. It returns *1* if the
- process has been launched sucessfully and *0* if not.
+ process has been launched successfully and *0* if not.
The *poll* method checks if the process is still running
@@ -108,55 +108,55 @@
both external programs (like "/bin/echo") or one of your
self-defined subroutines (like "foo()") in a new process.
- Starting External Programs
- For an external program to be started, call
-
- $status = $proc->start("program-name");
-
- If you want to pass a couple of parameters to the launched program,
- there's two options: You can either pass them in one argument like in
-
- $status = $proc->start("/bin/echo hello world");
-
- or in several arguments like in
-
- $status = $proc->start("/bin/echo", "hello", "world");
-
- Just as in Perl's function "system()", there's a big difference between
- the two methods: If you provide one argument containing a
- blank-separated command line, your shell is going to process any
- meta-characters (if you choose to use some) before the process is
- actually launched:
-
- $status = $proc->start("/bin/ls -l /etc/initt*");
-
- will expand "/etc/initt*" to "/etc/inittab" before running the "ls"
- command. If, on the other hand, you say
-
- $status = $proc->start("/bin/ls", "-l", "*");
-
- the "*" will stay unexpanded, meaning you'll look for a file with the
- literal name "*" (which is unlikely to exist on your system unless you
- deliberately create confusingly named files :). For more info on this,
- look up "perldoc -f exec".
-
- Starting Subroutines
- If, on the other hand, you want to start a Perl subroutine in the
- background, simply provide the function reference like
-
- $status = $proc->start(\&your_function);
-
- or supply an unnamed subroutine:
-
- $status = $proc->start( sub { sleep(1) } );
-
- You can also provide additional parameters to be passed to the function:
-
- $status = $proc->start(\&printme, "hello", "world");
-
- The *start* Method returns immediately after starting the specified
- process in background, i.e. non-blocking mode. It returns *1* if the
- process has been launched sucessfully and *0* if not.
+ For an external program to be started, call
+
+ $status = $proc->start("program-name");
+
+ If you want to pass a couple of parameters to the launched program,
+ there's two options: You can either pass them in one argument like
+ in
+
+ $status = $proc->start("/bin/echo hello world");
+
+ or in several arguments like in
+
+ $status = $proc->start("/bin/echo", "hello", "world");
+
+ Just as in Perl's function "system()", there's a big difference
+ between the two methods: If you provide one argument containing a
+ blank-separated command line, your shell is going to process any
+ meta-characters (if you choose to use some) before the process is
+ actually launched:
+
+ $status = $proc->start("/bin/ls -l /etc/initt*");
+
+ will expand "/etc/initt*" to "/etc/inittab" before running the "ls"
+ command. If, on the other hand, you say
+
+ $status = $proc->start("/bin/ls", "-l", "*");
+
+ the "*" will stay unexpanded, meaning you'll look for a file with
+ the literal name "*" (which is unlikely to exist on your system
+ unless you deliberately create confusingly named files :). For more
+ info on this, look up "perldoc -f exec".
+
+ If, on the other hand, you want to start a Perl subroutine in the
+ background, simply provide the function reference like
+
+ $status = $proc->start(\&your_function);
+
+ or supply an unnamed subroutine:
+
+ $status = $proc->start( sub { sleep(1) } );
+
+ You can also provide additional parameters to be passed to the
+ function:
+
+ $status = $proc->start(\&printme, "hello", "world");
+
+ The *start* Method returns immediately after starting the specified
+ process in background, i.e. non-blocking mode. It returns *1* if the
+ process has been launched successfully and *0* if not.
poll
The *poll* method checks if the process is still running
@@ -246,25 +246,21 @@
Switches debug messages on and off -- Proc::Simple::debug(1)
switches them on, Proc::Simple::debug(0) keeps Proc::Simple quiet.
+ cleanup
+ Proc::Simple keeps around data of terminated processes, e.g. you can
+ check via "t0()" and "t1()" how long a process ran, even if it's
+ long gone. Over time, this data keeps occupying more and more memory
+ and if you have a long-running program, you might want to run
+ "Proc::Simple->cleanup()" every once in a while to get rid of data
+ pertaining to processes no longer in use.
+
NOTE
Please keep in mind that there is no guarantee that the SIGTERM signal
really terminates a process. Processes can have signal handlers defined
that avoid the shutdown. If in doubt, whether a process still exists,
check it repeatedly with the *poll* routine after sending the signal.
-REQUIREMENTS
- I'd recommend using perl 5.6.0 although it might also run with 5.003 --
- if you don't have it, this is the time to upgrade!
-
- LEGALESE Copyright 1996 by Mike Schilli, all rights reserved. This
- program is free software, you can redistribute it and/or modify it under
- the same terms as Perl itself.
-
-AUTHOR
- Michael Schilli <michael at perlmeister.com>
-
- Contributors:
-
+Contributors
Tim Jenness <t.jenness at jach.hawaii.edu> did
kill_on_destroy/signal_on_destroy/pid
@@ -283,16 +279,11 @@
Brad Cavanagh fixed RT33440 (unreliable $?)
-POD ERRORS
- Hey! The above document had some coding errors, which are explained
- below:
-
- Around line 178:
- You forgot a '=back' before '=head2'
-
- Around line 282:
- '=item' outside of any '=over'
-
- Around line 720:
- You forgot a '=back' before '=head1'
-
+AUTHOR
+ 1996, Mike Schilli <cpan at perlmeister.com>
+
+LICENSE
+ Copyright 1996-2011 by Mike Schilli, all rights reserved. This program
+ is free software, you can redistribute it and/or modify it under the
+ same terms as Perl itself.
+
Modified: branches/upstream/libproc-simple-perl/current/Simple.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libproc-simple-perl/current/Simple.pm?rev=76608&op=diff
==============================================================================
--- branches/upstream/libproc-simple-perl/current/Simple.pm (original)
+++ branches/upstream/libproc-simple-perl/current/Simple.pm Mon Jun 27 07:09:36 2011
@@ -79,7 +79,7 @@
The I<start> Method returns immediately after starting the
specified process in background, i.e. there's no blocking.
It returns I<1> if the process has been launched
-sucessfully and I<0> if not.
+successfully and I<0> if not.
The I<poll> method checks if the process is still running
@@ -105,7 +105,7 @@
behaviour is turned off (see the kill_on_destroy and
signal_on_destroy methods).
-=cut
+=cut
require 5.003;
use strict;
@@ -117,7 +117,7 @@
@ISA = qw(Exporter AutoLoader);
@EXPORT = qw( );
-$VERSION = '1.27';
+$VERSION = '1.28';
######################################################################
# Globals: Debug and the mysterious waitpid nohang constant.
@@ -145,7 +145,7 @@
It takes no arguments.
-=cut
+=cut
######################################################################
# $proc_obj=Proc::Simple->new(); - Constructor
@@ -175,8 +175,6 @@
(like C</bin/echo>) or one of your self-defined subroutines
(like C<foo()>) in a new process.
-=head2 Starting External Programs
-
For an external program to be started, call
$status = $proc->start("program-name");
@@ -209,8 +207,6 @@
you deliberately create confusingly named files :). For
more info on this, look up C<perldoc -f exec>.
-=head2 Starting Subroutines
-
If, on the other hand, you want to start a Perl subroutine
in the background, simply provide the function reference like
@@ -227,9 +223,9 @@
The I<start> Method returns immediately after starting the
specified process in background, i.e. non-blocking mode.
It returns I<1> if the process has been launched
-sucessfully and I<0> if not.
-
-=cut
+successfully and I<0> if not.
+
+=cut
######################################################################
# $ret = $proc_obj->start("prg"); - Launch process
@@ -287,7 +283,7 @@
and returns I<1> if it is, I<0> if it's not.
-=cut
+=cut
######################################################################
# $ret = $proc_obj->poll(); - Check process status
@@ -332,7 +328,7 @@
sends the SIGUSR1 signal to the running process. I<kill> returns I<1> if
it succeeds in sending the signal, I<0> if it doesn't.
-=cut
+=cut
######################################################################
# $ret = $proc_obj->kill([SIGXXX]); - Send signal to process
@@ -372,7 +368,7 @@
$proc->kill_on_destroy(1); # Set flag to true
$proc->kill_on_destroy(0); # Set flag to false
-=cut
+=cut
######################################################################
# Method to set the kill_on_destroy flag
@@ -394,7 +390,7 @@
$current = $proc->signal_on_destroy;
$proc->signal_on_destroy("KILL");
-=cut
+=cut
######################################################################
# Send a signal on destroy
@@ -424,7 +420,7 @@
Call this method before running the start method.
-=cut
+=cut
######################################################################
sub redirect_output {
@@ -445,7 +441,7 @@
$pid = $proc->pid;
-=cut
+=cut
######################################################################
sub pid {
@@ -468,7 +464,7 @@
$t0 = $proc->t0();
-=cut
+=cut
######################################################################
sub t0 {
@@ -487,7 +483,7 @@
$t1 = $proc->t1();
-=cut
+=cut
######################################################################
sub t1 {
@@ -505,7 +501,7 @@
associated with the object is sent the signal_on_destroy
signal (SIGTERM if undefined).
-=cut
+=cut
######################################################################
# Destroy method
@@ -536,7 +532,9 @@
}
}
delete $EXIT_STATUS{ $self->pid };
- $DESTROYED{ $self->pid } = 1;
+ if( $self->poll() ) {
+ $DESTROYED{ $self->pid } = 1;
+ }
}
######################################################################
@@ -546,7 +544,7 @@
Returns the exit status of the process as the $! variable indicates.
If the process is still running, C<undef> is returned.
-=cut
+=cut
######################################################################
# returns the exit status of the child process, undef if the child
@@ -567,7 +565,7 @@
waits until the process is done and returns its exit status.
-=cut
+=cut
######################################################################
# waits until the child process terminates and then
@@ -668,10 +666,33 @@
Switches debug messages on and off -- Proc::Simple::debug(1) switches
them on, Proc::Simple::debug(0) keeps Proc::Simple quiet.
-=cut
+=cut
# Proc::Simple::debug($level) - Turn debug on/off
sub debug { $Debug = shift; }
+
+######################################################################
+
+=item cleanup
+
+Proc::Simple keeps around data of terminated processes, e.g. you can check via
+C<t0()> and C<t1()> how long a process ran, even if it's long gone. Over time,
+this data keeps occupying more and more memory and if you have a long-running
+program, you might want to run C<Proc::Simple-E<gt>cleanup()> every once in a
+while to get rid of data pertaining to processes no longer in use.
+
+=cut
+
+sub cleanup {
+
+ for my $pid ( keys %INTERVAL ) {
+ if( !exists $DESTROYED{ $pid } ) {
+ # process has been reaped already, safe to delete
+ # its start/stop time
+ delete $INTERVAL{ $pid };
+ }
+ }
+}
######################################################################
# Internal debug print function
@@ -717,6 +738,8 @@
__END__
+=back
+
=head1 NOTE
Please keep in mind that there is no guarantee that the SIGTERM
@@ -725,21 +748,7 @@
If in doubt, whether a process still exists, check it
repeatedly with the I<poll> routine after sending the signal.
-=head1 REQUIREMENTS
-
-I'd recommend using perl 5.6.0 although it might also run with 5.003
--- if you don't have it, this is the time to upgrade!
-
-LEGALESE
-Copyright 1996 by Mike Schilli, all rights reserved. This program is
-free software, you can redistribute it and/or modify it under the same
-terms as Perl itself.
-
-=head1 AUTHOR
-
-Michael Schilli <michael at perlmeister.com>
-
-Contributors:
+=head1 Contributors
Tim Jenness <t.jenness at jach.hawaii.edu>
did kill_on_destroy/signal_on_destroy/pid
@@ -759,4 +768,13 @@
Brad Cavanagh fixed RT33440 (unreliable $?)
-=cut
+=head1 AUTHOR
+
+ 1996, Mike Schilli <cpan at perlmeister.com>
+
+=head1 LICENSE
+
+Copyright 1996-2011 by Mike Schilli, all rights reserved.
+This program is free software, you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
Modified: branches/upstream/libproc-simple-perl/current/t/mult.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libproc-simple-perl/current/t/mult.t?rev=76608&op=diff
==============================================================================
--- branches/upstream/libproc-simple-perl/current/t/mult.t (original)
+++ branches/upstream/libproc-simple-perl/current/t/mult.t Mon Jun 27 07:09:36 2011
@@ -41,5 +41,7 @@
check(!$i->poll());
}
+Proc::Simple->cleanup();
+
1;
More information about the Pkg-perl-cvs-commits
mailing list