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 of Test2::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_name in 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 the yath init command. that's it, that's the whole job, and she does it flawlessly.
  • fit_to_width($width, $join, $text) β€” This splits $text on space, then recombines it using $join, inserting newlines as necessary, all in an attempt to fit the text into $width horizontal 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 closes STDOUT and reopens it pointing at STDERR. The result? Any print statement that doesn't specify a filehandle will print to STDERR instead of STDOUT, and also any print directly to STDOUT will instead go to STDERR. A filehandle to the real STDOUT is returned for you to use when you actually want to write to STDOUT. Real ones know why: this is used by some yath processes that need to print structured data to STDOUT without letting any third party modules they may load write to the real STDOUT. protect the output at all costs πŸ’€
  • $path_to_script = find_yath() β€” Attempts to find the yath command 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 the Config module. 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 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