Provided by: libtest2-harness-perl_1.000155-1_all bug

NAME

       App::Yath::Util - General utilities for yath that do not fit anywhere else.

DESCRIPTION

       This package exports several tools used throughout yath that did not fit into any other package.

SYNOPSIS

           use App::Yath::Util qw{
               find_pfile
               find_in_updir
               is_generated_test_pl
               fit_to_width
               isolate_stdout
               find_yath
           };

EXPORTS

       Note that nothing is exported by default, you must request each function to import.

       $path_to_pfile = find_pfile($settings, %params)
           The first argument must be an instance of Test2::Harness::Settings.

           Currently  the  only  supported  param is "vivify", when set to true the pfile will be created if one
           does not already exist.

           The pfile is a file that tells yath that a persistent runner is active, and how to  communicate  with
           it.

       $path_to_file = find_in_updir($file_name)
           Look for $file_name in the current directory or any parent directory.

       $bool = is_generated_test_pl($path_to_test_file)
           Check if the specified test file was generated by the "yath init" command.

       fit_to_width($width, $join, $text)
           This will split the $text on space, and then recombine it using $join inserting newlines as necessary
           in  an attempt to fit the text into $width horizontal characters. If any words are larger than $width
           they will not be split and text-wrapping may occur if used for terminal display.

       $stdout = isolate_stdout()
           This will close STDOUT and reopen it to point at STDERR.  The  result  of  this  is  that  any  print
           statement  that does not specify a fielhandle will print to STDERR instead of STDOUT, in addition 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.

           This  is used by some yath processes that need to print structured data to STDOUT without letting any
           third part modules they may load write to the real STDOUT.

       $path_to_script = find_yath()
           This will attempt to find the "yath" command line script. When possible this  will  return  the  path
           that  was  used  to  launch  yath.  If yath was not run to start the process it will search the paths
           specified in the Config module. This will throw an exception if the script cannot be found.

           Note: The result is cached so that subsequent calls will return  the  same  path  even  if  something
           installs  a  new yath script in another location that would otherwise be found first. This guarentees
           that a single process will not switch scripts.

SOURCE

       The source code repository for Test2-Harness can be found at http://github.com/Test-More/Test2-Harness/.

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/

perl v5.36.0                                       2023-10-04                               App::Yath::Util(3pm)