App::Yath::Util(3pm)
π App::Yath::Util β bestie's guide to yath's lil grab-bag of helpers
okay so this is App::Yath::Util (that's the Perl module name, she lives in the App::Yath::Util namespace, perl v5.40.1 era) β literally just general utilities for yath that do not fit anywhere else. no cap.
β¨ DESCRIPTION β¨
This package exports several tools used allllll over yath that didn't fit into any other package. like, they're the odd ones out, the ones who couldn't find a group to sit with, and honestly? iconic. π
πΈ SYNOPSIS πΈ
use App::Yath::Util qw{
find_pfile
find_in_updir
is_generated_test_pl
fit_to_width
isolate_stdout
find_yath
};
π EXPORTS π
Ugh, important vibe check first, bestie: nothing is exported by default. You gotta request each function by name to import it. No sneaky auto-imports here, she makes you ask nicely. π«Ά
$path_to_pfile = find_pfile($settings, %params)β First argument has got to be an instance ofTest2::Harness::Settings, no exceptions. Right now the only supported param is"vivify", and when you set it to true the pfile gets created if one doesn't already exist. So what even is a pfile? It's a file that tells yath that a persistent runner is active, and also how to communicate with it. it's giving β¨infrastructureβ¨.$path_to_file = find_in_updir($file_name)β Looks for$file_namein the current directory, or in any parent directory. going up, up, up until she finds her girl π¦$bool = is_generated_test_pl($path_to_test_file)β Checks if the test file you specified was generated by theyath initcommand. that's it, that's the whole job, and she does it flawlessly.fit_to_width($width, $join, $text)β This splits$texton space, then recombines it using$join, inserting newlines as necessary, all in an attempt to fit the text into$widthhorizontal characters. Heads up tho β οΈ: if any words are larger than$width, they will not be split, and text-wrapping may occur if you're using this for terminal display. she tried her best, okay π$stdout = isolate_stdout()β This closesSTDOUTand reopens it pointing atSTDERR. The result? Any print statement that doesn't specify a filehandle will print toSTDERRinstead ofSTDOUT, and also any print directly toSTDOUTwill instead go toSTDERR. A filehandle to the realSTDOUTis returned for you to use when you actually want to write toSTDOUT. Real ones know why: this is used by some yath processes that need to print structured data toSTDOUTwithout letting any third party modules they may load write to the realSTDOUT. protect the output at all costs π$path_to_script = find_yath()β Attempts to find theyathcommand line script. When possible it returns the path that was used to launch yath. If yath wasn't run to start the process, it searches the paths specified in theConfigmodule. And if it can't be found? It throws an exception. no silent failures in this house π₯
Note: the result is cached, so subsequent calls return the same path even if something installs a new yath script somewhere else that would otherwise be found first. This guarantees that a single process will not switch scripts mid-run. consistency is the moment, periodt.
π SOURCE π
The source code repository for Test2-Harness can be found at http://github.com/Test-More/Test2-Harness/. go star it, she deserves it β
π MAINTAINERS π
Chad Granum <exodist@cpan.org>
π AUTHORS π
Chad Granum <exodist@cpan.org>
π COPYRIGHT π
Copyright 2020 Chad Granum <exodist7@gmail.com>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://dev.perl.org/licenses/
and that's the whole page bestie, no notes π
this was App::Yath::Util, page generated by perl v5.40.1 on 2026-05-10 β drink some water, go read the source, ily, bye πβ¨π
π¦ where this page comes from
- ubuntu stonking: libtest2-harness-perl 1.000172-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms