App-Slaughter
view release on metacpan or search on metacpan
bin/slaughter view on Meta::CPAN
$val = "undefined" if ( !defined($val) );
print sprintf( "%-20s => %s", $var, $val ) . "\n";
}
exit;
}
#
# At this point we should lock ourselves - we've parsed the command-line
# and we might have an updated lockfile - because this is the start of
# "real" work.
#
createLock();
#
# Create a temporary directory, some transports need such a thing.
#
createTransportDir();
examples/file-copy/policies/default.policy view on Meta::CPAN
#
if ( FetchFile( Source => "/etc/motd",
Dest => "/etc/motd",
Owner => "root",
Expand => "true",
Group => "root",
Mode => "644" ) )
{
LogMessage( Message => "The local file /etc/motd was updated.",
Severity => "FetchFile" );
}
lib/Slaughter/API/generic.pm view on Meta::CPAN
Line => "All: 1.2.3.4" );
=for example end
The following parameters are available:
=over
=item File [mandatory]
The filename which should be examined and potentially updated.
=item Line [mandatory]
The line which should be searched for and potentially appended.
=back
=cut
sub AppendIfMissing
lib/Slaughter/API/generic.pm view on Meta::CPAN
The following parameters are available:
=over
=item Comment [default: "#"]
The value to comment out the line with.
=item File [mandatory]
The filename which should be examined and potentially updated.
=item Pattern [mandatory]
The regular expression to match with.
=back
The return value of this function is the number of lines updated,
or -1 if the file could not be opened.
=cut
sub CommentLinesMatching
{
my (%params) = (@_);
my $pattern = $params{ 'Pattern' };
my $comment = $params{ 'Comment' } || "#";
lib/Slaughter/API/generic.pm view on Meta::CPAN
The following is an example of usage:
=for example begin
if ( FetchFile( Source => "/etc/motd",
Dest => "/etc/motd",
Owner => "root",
Group => "root",
Mode => "644" ) )
{
# File was created/updated.
}
else
{
# File already existed locally with the same contents.
}
=for example end
The following parameters are available:
lib/Slaughter/API/generic.pm view on Meta::CPAN
Replace => "PermitRootLogin no" );
=for example end
The following parameters are available:
=over
=item File [mandatory]
The filename which should be examined and potentially updated.
=item Pattern [mandatory]
The pattern to test and potentially replace.
=item Replace [mandatory]
The replacement text to use.
=back
The return value of this function is the number of lines updated,
0 if none, or -1 if the file could not be opened.
=cut
sub ReplaceRegexp
{
my (%params) = (@_);
my $pattern = $params{ 'Pattern' };
my $replace = $params{ 'Replace' } || "";
t/test-lib-slaughter-info.t view on Meta::CPAN
#
# Call the function
#
$info = $handle->getInformation();
ok( $info, "undef wasn't returned." );
#
# We should now find the hash has an entry or two.
#
ok( keys %$info >= 1,
"After calling Slaughter::Info::$module our hash is updated" );
}
}
( run in 0.243 second using v1.01-cache-2.11-cpan-05444aca049 )