From c66f595f6ee84d5211bf9ca96f0eef35160e9ccc Mon Sep 17 00:00:00 2001 From: Bodo Hugo Barwich Date: Sat, 30 Dec 2023 15:25:02 +0300 Subject: [PATCH 1/2] Extend documentation on Process::SubProcess --- Makefile.PL | 1 + lib/Process/SubProcess.pm | 92 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 86 insertions(+), 7 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index 484ccc2..e9b3c1a 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -24,6 +24,7 @@ WriteMakefile( 'JSON' => '0', 'YAML' => '0', 'Data::Dump' => '0', + 'Time::HiRes' => '0', }, META_MERGE => { 'meta-spec' => { version => 2 }, diff --git a/lib/Process/SubProcess.pm b/lib/Process/SubProcess.pm index a3b0e2f..21dad1e 100644 --- a/lib/Process/SubProcess.pm +++ b/lib/Process/SubProcess.pm @@ -44,7 +44,7 @@ use IO::Select; use IPC::Open3; use Symbol qw(gensym); -our $VERSION = '2.1.10'; +our $VERSION = '2.1.11'; =head1 DESCRIPTION @@ -69,7 +69,9 @@ use constant FLAG_STDOUT => 1; use constant FLAG_STDERR => 2; use constant FLAG_ANYOUT => 3; -=head1 STATIC METHODS +=head1 METHODS + +=head2 Static Methods =over 4 @@ -133,7 +135,7 @@ sub runSubProcess { #---------------------------------------------------------------------------- #Constructors -=head1 CONSTRUCTOR +=head2 Constructor =over 4 @@ -214,7 +216,7 @@ sub DESTROY { #---------------------------------------------------------------------------- #Administration Methods -=head1 Administration Methods +=head2 Administration Methods =over 4 @@ -506,6 +508,27 @@ sub setProfiling { } } +=pod + +=over 4 + +=item setDebug ( DEBUG ) + +This method enables the C option. + +B + +C - whole number to enable or disable the C mode. Negative numbers or C< 0 > +will disable it. Positive numbers or C< 1 > will enable it. + +See L|/"Kill ()"> + +See L|/"freeResources ()"> + +=back + +=cut + sub setDebug { my $self = shift; @@ -1325,6 +1348,25 @@ sub Kill { } #if($self->isRunning) } +=pod + +=over 4 + +=item freeResources () + +This method removes all file handles to used pipes if it is not running anymore. + +If the process is still running it will be killed with the C method. + +Enabling the C option will additionally include an B from +which method C was called. + +See L|/"Kill ()"> + +=back + +=cut + sub freeResources { my $self = shift; @@ -1346,6 +1388,21 @@ sub freeResources { } #if($self->isRunning < 1) } +=pod + +=over 4 + +=item clearErrors () + +This method resets all data collected during the process execution. + +This prepares the object for the re-use with a new command or re-launch +the same command with the same configuration. + +=back + +=cut + sub clearErrors() { my $self = shift; @@ -1360,11 +1417,11 @@ sub clearErrors() { #---------------------------------------------------------------------------- #Consultation Methods -=pod +=head2 Consultation Methods =over 4 -=item getProcessID +=item getProcessID () This Method will return the B of the process which was assigned by the system at launch time. @@ -1387,7 +1444,7 @@ sub getProcessID { =over 4 -=item getName +=item getName () This Method will return the Name to the C object if any was assigned with the C method. @@ -1404,6 +1461,27 @@ sub getName { return $_[0]->{"_name"}; } +=pod + +=over 4 + +=item getNameComplete () + +This Method will return the Name to the C object if any was assigned +with the C method. Additionally it adds the Process ID of the process. + +If the C is not set the C will be used as name. + +B The C with C of the C object as string. + +See L|/"setName ( NAME )"> + +See L|/"getName ()"> + +=back + +=cut + sub getNameComplete { my $self = $_[0]; my $rsnm = ''; From a7756a34d0740af84bc2703769fa6955d2d7dc08 Mon Sep 17 00:00:00 2001 From: Bodo Hugo Barwich Date: Sat, 30 Dec 2023 16:14:28 +0300 Subject: [PATCH 2/2] isDebug() documentation --- lib/Process/SubProcess.pm | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/lib/Process/SubProcess.pm b/lib/Process/SubProcess.pm index 21dad1e..3c49fdd 100644 --- a/lib/Process/SubProcess.pm +++ b/lib/Process/SubProcess.pm @@ -514,11 +514,11 @@ sub setProfiling { =item setDebug ( DEBUG ) -This method enables the C option. +This method enables the B mode. B -C - whole number to enable or disable the C mode. Negative numbers or C< 0 > +C - whole number to enable or disable the B mode. Negative numbers or C< 0 > will disable it. Positive numbers or C< 1 > will enable it. See L|/"Kill ()"> @@ -1312,7 +1312,7 @@ Any not yet read output will get lost. This will include an Error Message "I" and set the Process C to C< 4 > and the C to C< 9 >. -Enabling the C option will additionally include an B from +Enabling the B mode will additionally include an B from which method C was called. See L|/"Check ()"> @@ -1358,7 +1358,7 @@ This method removes all file handles to used pipes if it is not running anymore. If the process is still running it will be killed with the C method. -Enabling the C option will additionally include an B from +Enabling the B mode will additionally include an B from which method C was called. See L|/"Kill ()"> @@ -1624,6 +1624,22 @@ sub isProfiling { return $_[0]->{'_profiling'}; } +=pod + +=over 4 + +=item isDebug () + +This Method indicates whether the B mode is enabled. + +B It returns whole number representing the B mode. + +See L|/"setDebug ( DEBUG )"> + +=back + +=cut + sub isDebug { return $_[0]->{'_debug'}; }