Apache-Logmonster
view release on metacpan or search on metacpan
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
# If *ARGV is opened, we're interactive if...
if ( openhandle * ARGV ) {
# ...it's currently opened to the magic '-' file
return -t *STDIN if defined $ARGV && $ARGV eq '-';
# ...it's at end-of-file and the next file is the magic '-' file
return @ARGV > 0 && $ARGV[0] eq '-' && -t *STDIN if eof *ARGV;
# ...it's directly attached to the terminal
return -t *ARGV;
};
# If *ARGV isn't opened, it will be interactive if *STDIN is attached
# to a terminal and either there are no files specified on the command line
# or if there are files and the first is the magic '-' file
return -t *STDIN && ( @ARGV == 0 || $ARGV[0] eq '-' );
}
sub is_process_running {
my ( $self, $process ) = @_;
my $ps = $self->find_bin( 'ps', debug => 0 );
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
0 - failure
=item install_from_source_php
Downloads a PHP program and installs it. This function is not completed due to lack o interest.
=item is_interactive
tests to determine if the running process is attached to a terminal.
=item logfile_append
$util->logfile_append( file=>$file, lines=>\@lines )
Pass a filename and an array ref and it will append a timestamp and the array contents to the file. Here's a working example:
$util->logfile_append( file=>$file, prog=>"proggy", lines=>["Starting up", "Shutting down"] )
( run in 0.684 second using v1.01-cache-2.11-cpan-e1769b4cff6 )