NAME
Statocles::Util - Various utility functions to reduce dependencies
SYNOPSIS
use Statocles::Util qw( dircopy );
dircopy $source, $destination;
DESCRIPTION
This module contains some utility functions to help reduce non-core dependencies.
SUBROUTINES
trim
my $trimmed = trim $untrimmed;
Trim the leading and trailing whitespace from the given scalar.
dircopy
dircopy $source, $destination;
Copy everything in $source to $destination, recursively.
run_editor
my $content = run_editor( $path );
Invoke the user's text editor (from the EDITOR
environment variable) to edit the given path. Returns the content if the editor was invoked, or undef
EDITOR
was not set. If the editor was not able to be invoked (EDITOR
was set but could not be run), an exception is thrown.
uniq_by
my @uniq_links = uniq_by { $_->href } @links;
Filter a list into its unique items based on the result of the passed-in block. This lets us get unique links from their href
attribute.
derp
derp "This feature is deprecated in file '%s'", $file;
Print out a deprecation message as a warning. A message will only be printed once for each set of arguments.
read_stdin
my $test = read_stdin();
Reads the standard input. Intended to provide a point to monkey-patch for tests.