Skip to content

Commit

Permalink
Merge pull request #53 from bodo-hugo-barwich/no-29_automated-documen…
Browse files Browse the repository at this point in the history
…tation

Extend Documentation on Process::SubProcess
  • Loading branch information
bodo-hugo-barwich committed Dec 30, 2023
2 parents 5729eae + a7756a3 commit 1d0582c
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 8 deletions.
1 change: 1 addition & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ WriteMakefile(
'JSON' => '0',
'YAML' => '0',
'Data::Dump' => '0',
'Time::HiRes' => '0',
},
META_MERGE => {
'meta-spec' => { version => 2 },
Expand Down
110 changes: 102 additions & 8 deletions lib/Process/SubProcess.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -133,7 +135,7 @@ sub runSubProcess {
#----------------------------------------------------------------------------
#Constructors

=head1 CONSTRUCTOR
=head2 Constructor
=over 4
Expand Down Expand Up @@ -214,7 +216,7 @@ sub DESTROY {
#----------------------------------------------------------------------------
#Administration Methods

=head1 Administration Methods
=head2 Administration Methods
=over 4
Expand Down Expand Up @@ -506,6 +508,27 @@ sub setProfiling {
}
}

=pod
=over 4
=item setDebug ( DEBUG )
This method enables the B<Debug> mode.
B<Parameters:>
C<DEBUG> - whole number to enable or disable the B<Debug> mode. Negative numbers or C< 0 >
will disable it. Positive numbers or C< 1 > will enable it.
See L<Method C<Kill()>|/"Kill ()">
See L<Method C<freeResources()>|/"freeResources ()">
=back
=cut

sub setDebug {
my $self = shift;

Expand Down Expand Up @@ -1289,7 +1312,7 @@ Any not yet read output will get lost.
This will include an Error Message "I<Process killing ...>"
and set the Process C<ERROR CODE> to C< 4 > and the C<EXIT CODE> to C< 9 >.
Enabling the C<DEBUG> option will additionally include an B<Error Message> from
Enabling the B<Debug> mode will additionally include an B<Error Message> from
which method C<Kill()> was called.
See L<Method C<Check()>|/"Check ()">
Expand Down Expand Up @@ -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<Kill> method.
Enabling the B<Debug> mode will additionally include an B<Error Message> from
which method C<freeResources()> was called.
See L<Method C<Kill()>|/"Kill ()">
=back
=cut

sub freeResources {
my $self = shift;

Expand All @@ -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;

Expand All @@ -1360,11 +1417,11 @@ sub clearErrors() {
#----------------------------------------------------------------------------
#Consultation Methods

=pod
=head2 Consultation Methods
=over 4
=item getProcessID
=item getProcessID ()
This Method will return the B<ProcessID> of the process which was assigned by the system
at launch time.
Expand All @@ -1387,7 +1444,7 @@ sub getProcessID {
=over 4
=item getName
=item getName ()
This Method will return the Name to the C<Process::SubProcess> object if any was assigned
with the C<setName()> method.
Expand All @@ -1404,6 +1461,27 @@ sub getName {
return $_[0]->{"_name"};
}

=pod
=over 4
=item getNameComplete ()
This Method will return the Name to the C<Process::SubProcess> object if any was assigned
with the C<setName()> method. Additionally it adds the Process ID of the process.
If the C<NAME> is not set the C<COMMAND> will be used as name.
B<Returns:> The C<NAME> with C<PID> of the C<Process::SubProcess> object as string.
See L<Method C<setName()>|/"setName ( NAME )">
See L<Method C<getName()>|/"getName ()">
=back
=cut

sub getNameComplete {
my $self = $_[0];
my $rsnm = '';
Expand Down Expand Up @@ -1546,6 +1624,22 @@ sub isProfiling {
return $_[0]->{'_profiling'};
}

=pod
=over 4
=item isDebug ()
This Method indicates whether the B<Debug> mode is enabled.
B<Returns:> It returns whole number representing the B<Debug> mode.
See L<Method C<setDebug()>|/"setDebug ( DEBUG )">
=back
=cut

sub isDebug {
return $_[0]->{'_debug'};
}
Expand Down

0 comments on commit 1d0582c

Please sign in to comment.