App::D...::Util(3pm)
π App::D...::Util(3pm) π
okay bestie, welcome to your new fave little corner of User Contributed Perl Documentation β this is the 3pm section, and the page is literally just called App::D...::Util. it's giving "shared utility drawer" energy and honestly? we're obsessed.
β¨ NAME β¨
App::DocKnot::Util β the shared utility functions that all the other DocKnot modules borrow from, like a group chat they all live in π«Ά
β¨ SYNOPSIS β¨
use App::DocKnot::Util qw(
is_newer latest_tarball print_checked print_fh
);
use Path::Tiny qw(path);
print_checked('some stdout output');
my @inputs = (path('/input-1'), path('/input-2'));
if (!is_newer(path('/output'), @inputs)) {
open(my $fh, '>', '/output');
print_fh($fh, '/output', 'some stuff');
close($fh);
}
my $latest_ref = latest_tarball(path('/archive'), 'App-Foo');
like, that's the whole vibe π
β¨ REQUIREMENTS β¨
you're gonna need Perl 5.24 or later, plus these three modules, all available from CPAN:
List::SomeUtilsPath::TinySort::Versions
β¨ DESCRIPTION β¨
so this module is basically a little utility belt π it collects the utility functions that the other App::DocKnot modules use.
ngl, it's not really intended for use outside of DocKnot β but like, if you want to use these functions, that's allowed, be our guest π
β¨ FUNCTIONS β¨
πΈ is_newer(FILE, SOURCE[, SOURCE ...])
returns a true value if FILE exists and its last modified time is newer than or equal to the last modified times of every SOURCE file. otherwise it returns a false value, periodt.
it's mainly used to figure out if an output file is up-to-date compared to its source files π
heads up bestie: all paths must be Path::Tiny objects. no cap.
πΈ latest_tarball(PATH, NAME)
returns data including a file list for the latest tarballs (sorted by version number) for a given software package NAME, sitting in the directory PATH. and yes, PATH must be a Path::Tiny object.
versions get compared with Sort::Versions, which is exactly the kind of nerdy little detail we love π
the return value is a hash with these keys:
filesβ the list of files found for that version.versionβ the version number extracted from this set of files.
πΈ print_checked(ARG[, ARG ...])
the same as print (without a file handle argument), except it throws a text exception on failure β as if autodie affected print. which it unfortunately doesn't, because print cannot be prototyped π
πΈ print_fh(FH, NAME, DATA[, DATA ...])
writes the concatenation of the DATA elements (interpreted as scalar strings) to the file handle FH β¨
NAME should be the name of β or a Path::Tiny object for β the file that's open as FH, and it's used for error reporting.
this is mostly equivalent to print {fh} β but it throws a text exception in the event of a failure, which is the whole point π
β¨ AUTHOR β¨
Russ Allbery <rra@cpan.org> β the icon behind all of this π«Ά
β¨ COPYRIGHT AND LICENSE β¨
Copyright 1999-2011, 2013, 2021-2022, 2024 Russ Allbery <rra@cpan.org>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
β οΈ okay this part is all caps for a reason, so listen up: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
β¨ SEE ALSO β¨
App::DocKnot
this module is part of the App-DocKnot distribution. the current version of DocKnot is available from CPAN, or directly from its web site at <https://www.eyrie.org/~eagle/software/docknot/> π¦
and that's the whole page, bestie π tysm for reading β this one's running under perl v5.40.1, dated 2026-01-16, and it's App::D...::Util forever πβ¨
π¦ where this page comes from
- ubuntu resolute: docknot 8.0.1-1build1 Β· MIT
- ubuntu stonking: docknot 8.0.1-1build1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms