App::D...::Util(3pm)

πŸ“¦
version 8.0.1 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– 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::SomeUtils
  • Path::Tiny
  • Sort::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.

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 😭

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 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