Footprintless::Util - A utility method package for common functionality in Footprintless
version 1.01
use Footprintless::Util qw( agent default_command_runner dumper exit_due_to slurp spurt ); my $agent = agent(); my $command_runner = default_command_runner(); my $dumper = dumper(); eval { $command_runner->run_or_die('cat /foo/bar'); }; exit_due_to($@) if ($@); my $content = slurp('/foo/bar'); spurt('baz', '/foo/bar', append => 1);
This module contains common utility methods used by Footprintless.
Returns a new instance of LWP::UserAgent
configured with env_proxy
.
Returns a new instance of the default implementation of Footprintless::CommandRunner
.
Prints a dump of @to_dump
using Data::Dumper
with Data::Dumper::Indent
set to 1.
If $reason
is an instance of Footprintless::CommandRunner::Exception
, $reason->exit()
will be called. Otherwise, $reason
will be printed to STDERR
and exit(255)
will be called.
Reads the entire contents of $file
in one gulp.
Writes $content
to $file
. The available options are:
If truthy, $content
will be appended to $file
instead of overwriting.
Lucas Theisen <lucastheisen@pastdev.com>
This software is copyright (c) 2016 by Lucas Theisen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Please see those modules/websites for more information related to this module.