Apache-Logmonster
view release on metacpan or search on metacpan
bin/install_deps.pl view on Meta::CPAN
use CPAN;
use English qw( -no_match_vars );
my $deps = {
'modules' => [
{ module => 'Date::Format' , info => { port => 'TimeDate' } },
{ module => 'Params::Validate' , info => {} },
{ module => 'Mail::Send' , info => { port => 'Mail::Tools' } },
{ module => 'Regexp::Log' , info => {} },
# { module => 'Mail::Toaster' , info => {} },
# { module => 'Provision::Unix' , info => {} },
],
'apps' => [
# { app => 'expat' , info => { port => 'expat2', dport=>'expat2' } },
# { app => 'gettext' , info => { port => 'gettext', dport=>'gettext'} },
# { app => 'gmake' , info => { port => 'gmake', dport=>'gmake' } },
]
};
$EUID == 0 or die "You will have better luck if you run me as root.\n";
bin/install_deps.pl view on Meta::CPAN
my ($module, $version) = @_;
print " from CPAN...";
# some Linux distros break CPAN by auto/preconfiguring it with no URL mirrors.
# this works around that annoying little habit
no warnings;
$CPAN::Config = get_cpan_config();
use warnings;
if ( $module eq 'Provision::Unix' && $version ) {
$module =~ s/\:\:/\-/g;
$module = "M/MS/MSIMERSON/$module-$version.tar.gz";
}
CPAN::Shell->install($module);
}
sub install_module_darwin {
my ($module, $info, $version) = @_;
my $dport = '/opt/local/bin/port';
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
print " from CPAN...";
require CPAN;
# some Linux distros break CPAN by auto/preconfiguring it with no URL mirrors.
# this works around that annoying little habit
no warnings;
$CPAN::Config = get_cpan_config();
use warnings;
if ( $module eq 'Provision::Unix' && $version ) {
$module =~ s/\:\:/\-/g;
$module = "M/MS/MSIMERSON/$module-$version.tar.gz";
}
CPAN::Shell->install($module);
}
sub install_module_darwin {
my $self = shift;
my $module = shift;
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
if ( $strip && $val && $val =~ /#/ ) {
# removes everything from a # to the right, including
# any spaces to the left of the # symbol.
($val) = $val =~ /(.*?\S)\s*#/;
}
return ( $key, $val );
}
sub provision_unix {
my $self = shift;
$self->install_module( 'Provision::Unix' );
}
sub regexp_test {
my $self = shift;
my %p = validate(
@_,
{ 'exp' => { type => SCALAR },
'string' => { type => SCALAR },
'pbp' => { type => BOOLEAN, optional => 1, default => 0 },
%std_opts,
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
result:
0 - files are the same
1 - files are different
-1 - error.
=item find_bin
Check all the "normal" locations for a binary that should be on the system and returns the full path to the binary.
$util->find_bin( 'dos2unix', dir=>'/opt/local/bin' );
Example:
my $apachectl = $util->find_bin( "apachectl", dir=>"/usr/local/sbin" );
arguments required:
bin - the name of the program (its filename)
arguments optional:
t/Utility.t view on Meta::CPAN
ok( $util->sudo(), 'sudo' );
}
else {
ok( !$util->sudo( fatal => 0 ), 'sudo' );
}
$log->dump_audit( quiet => 1 );
$log->{last_error} = scalar @{$log->{errors}};
# syscmd
my $tmpfile = '/tmp/provision-unix-test';
ok( $util->syscmd( "touch $tmpfile", fatal => 0 ), 'syscmd +');
ok( ! $util->syscmd( "rm $tmpfile.nonexist", fatal => 0,debug=>0 ), 'syscmd -');
ok( ! $util->syscmd( "rm $tmpfile.nonexist", fatal => 0,,debug=>0, timeout=>1), 'syscmd - (w/timeout)');
ok( $util->syscmd( "rm $tmpfile", fatal => 0, ), 'syscmd +');
ok( $util->syscmd( "$rm $tmp/maildrop-qmail-domain", fatal => 0, ),
'syscmd +'
) if ( $network && -f "$tmp/maildrop-qmail-domain" );
# file_delete
ok( $util->file_delete( $backup ), 'file_delete' );
( run in 1.783 second using v1.01-cache-2.11-cpan-39bf76dae61 )