Peter Flanigan > Class-Usul > Class::Usul::IPC

Download:
class-usul/Class-Usul-0.51.1.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Module Version: v0.51.1   Source  

Name ^

Class::Usul::IPC - List/Create/Delete processes

Synopsis ^

   use Class::Usul;
   use Class::Usul::IPC;

   my $ipc = Class::Usul::IPC->new( builder => Class::Usul->new );

   $result_object = $ipc->run_cmd( [ qw( ls -l ) ] );

Description ^

Displays the process table and allows signals to be sent to selected processes

Configuration and Environment ^

Defines these attributes;

cache_ttys

Boolean that defaults to true. Passed to Proc::ProcessTable

Subroutines/Methods ^

child_list

   @pids = $self->child_list( $pid );

Called with a process id for an argument this method returns a list of child process ids

popen

   $response = $self->popen( $cmd, @opts );

Uses IPC::Open3 to fork a command and pipe the lines of input into it. Returns a Class::Usul::Response::IPC object. The response object's out method returns the STDOUT from the command. Throws in the event of an error. See "run_cmd" for a full list of options and response attributes

process_exists

   $bool = $self->process_exists( file => $path, pid => $pid );

Tests for the existence of the specified process. Either specify a path to a file containing the process id or specify the id directly

process_table

Generates the process table data used by the HTML::FormWidget table subclass. Called by "proc_table" in Class::Usul::Model::Process

run_cmd

   $response = $self->run_cmd( $cmd, $opts );

Runs the given command. If $cmd is a string then an implementation based on the IPC::Open3 function is used. If $cmd is an array reference then an implementation using fork and exec in Class::Usul::IPC::Cmd is used to execute the command. If the command contains pipes then an implementation based on IPC::Run is used if it is installed. If IPC::Run is not installed then the arrayref is joined with spaces and the system implementation is used. The $opts hash reference and the $response object are described in Class::Usul::IPC::Cmd

On MSWin32 the "popen" method is used instead. That method does not support the async option

signal_process

Send a signal the the selected processes. Invokes the suid root wrapper

signal_process_as_root

   $self->signal_process( [{] param => value, ... [}] );

This is called by processes running as root to send signals to selected processes. The passed parameters can be either a list of key value pairs or a hash ref. Either a single pid, or an array ref pids, or file must be passwd. The file parameter should be a path to a file containing process ids one per line. The sig defaults to TERM. If the flag parameter is set to one then the given signal will be sent once to each selected process. Otherwise each process and all of it's children will be sent the signal. If the force parameter is set to true the after a grace period each process and it's children are sent signal KILL

Diagnostics ^

None

Dependencies ^

Class::Usul
Class::Usul::Constants
Class::Usul::IPC::Cmd
Class::Usul::Response::IPC
Class::Usul::Response::Table
Module::Load::Conditional
Proc::ProcessTable
Try::Tiny

Incompatibilities ^

There are no known incompatibilities in this module

Bugs and Limitations ^

There are no known bugs in this module. Please report problems to the address below. Patches are welcome

Author ^

Peter Flanigan, <pjfl@cpan.org>

License and Copyright ^

Copyright (c) 2014 Peter Flanigan. All rights reserved

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic

This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE

syntax highlighting: