Footprintless::Util - A utility method package for common functionality in Footprintless
version 1.14
use Footprintless::Util qw( agent clean default_command_runner dumper exit_due_to extract resource_manager 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
Returns a new instance of Footprintless::ResourceManager configured with a maven provider if Maven::Agent is available, and a url provider in that order. If $agent is provided, it will be passed on to the providers.
Footprintless::ResourceManager
Maven::Agent
$agent
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 safe_level set to HIGH. Returns the new File::Temp object.
safe_level
HIGH
Creates a new temporary directory with safe_level set to HIGH. Returns the new File::Temp object.
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.