Footprintless::Util - A utility method package for common functionality in Footprintless
version 1.28
use Footprintless::Util qw( agent clean default_command_runner dumper exit_due_to extract slurp spurt temp_dir ); 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 agent. By default env_proxy is set. The supported options are:
env_proxy
A hashref for storing cookies. If not supplied, cookies will be ignored.
The http request timeout.
Removes all the entries in $paths (must be an array ref). If an entry ends with a / it is assumed to be a directory, and will be recreated.
$paths
/
Returns a new instance of the default implementation of Footprintless::CommandRunner.
Footprintless::CommandRunner
Prints a dump of @to_dump using Data::Dumper with Data::Dumper::Indent set to 1.
@to_dump
Data::Dumper
Data::Dumper::Indent
Require's and creates a new instance of $module_name, passing @new_args to the new method.
$module_name
@new_args
new
If $reason is an instance of Footprintless::CommandRunner::ExecutionException, $reason->exit() will be called. Otherwise, $reason will be printed to STDERR and exit(255) will be called. The $verbose argument will be passed on thusly: $reason->exit($verbose).
$reason
$reason->exit()
STDERR
exit(255)
$verbose
$reason->exit($verbose)
Will extract $archive. Will attempt to use Archive::Extract::Libarchive and if not found, will use Archive::Extract. The available options are:
$archive
The location to extract to. Defaults to cwd.
The type of the archive. If not specified, the type will be inferred by the file extension according to Lib::Archive. The following additional extensions will be inferred as type zip: ear, jar, twbx, war.
zip
ear
jar
twbx
war
Creates a new Footprintless::Factory. $entities can be either, a hashref, or a Config::Entities object. If a hashref, it will be used to create a new entities object, then passed along with options to the Footprintless::Factory constructor.
$entities
Footprintless::Factory
Dies with an instance of Footprintless::InvalidEntityException.
Replaces a portion of the start of $path. \%rebase must have 2 keys, from and to. The from value will be removed from $path and replaced with the to value.
$path
\%rebase
from
to
Reads the entire contents of $file in one gulp. If $file is omitted, then it will read STDIN.
$file
STDIN
Writes $content to $file. The available options are:
$content
Creates a new temporary file with mode 0600 Returns the new File::Temp object. Uses File::Temp so you can set File::Temp::HIGH for extra safety.
0600
File::Temp
File::Temp::HIGH
Creates a new temporary directory with mode 2700. Returns the new File::Temp object. Uses File::Temp so you can set File::Temp::HIGH for extra safety.
2700
Prints a dump of @to_dump using Data::Dumper with Data::Dumper::Indent set to 1 and Data::Dumper::Terse set to 1 - this will basically be the same as the dumper() function, except it will not include the variable name ($VAR1 = ).
Data::Dumper::Terse
dumper()
$VAR1 =
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.
Footprintless
To install Footprintless, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Footprintless
CPAN shell
perl -MCPAN -e shell install Footprintless
For more information on module installation, please visit the detailed CPAN module installation guide.