Test2::Harness::Util(3pm) | User Contributed Perl Documentation | Test2::Harness::Util(3pm) |
Test2::Harness::Util - General utiliy functions.
Justification: PERLBUG 31923 <https://rt.perl.org/Public/Bug/Display.html?id=31923> If utf8 is requested we use ':utf8' instead of ':encoding(utf8)' in order to avoid the thread segfault.
This is a reusable implementation of this:
sub apply_encoding { my ($fh, $enc) = @_; return unless $enc; return binmode($fh, ":utf8") if $enc =~ m/^utf-?8$/i; binmode($fh, ":encoding($enc)"); }
$search should be a module name with "*" wildcards replacing sections.
find_libraries('Foo::*::Baz') find_libraries('*::Bar::Baz') find_libraries('Foo::Bar::*')
These all look for modules matching the search, this is a good way to find plugins, or similar patterns.
The result is a hashref of "{ $module => $path }". If a module exists in more than 1 search path the first is used.
Resulting hash:
{ sig => ($? & 127), # Signal value if the exit was caused by a signal err => ($? >> 8), # Actual exit code, if any. dmp => ($? & 128), # Was there a core dump? all => $?, # Original exit value, unchanged }
Params:
Optional.
Note even if this is set to false '.' may still be included if it was in the initial list, or if it was in @INC and @INC was included using the "include_current" parameter.
These convert between module names like "Foo::Bar" and filenames like "Foo/Bar.pm".
This will open the file at $path and return a filehandle.
An exception will be thrown if the file cannot be opened.
NOTE: This will automatically use IO::Uncompress::Bunzip2 or IO::Uncompress::Gunzip to uncompress the file if it has a .bz2 or .gz extension.
An exception will be thrown if the file cannot be opened.
NOTE: This will automatically use IO::Uncompress::Bunzip2 or IO::Uncompress::Gunzip to uncompress the file if it has a .bz2 or .gz extension.
This will open the file at $path and return a filehandle.
"undef" is returned if the file cannot be opened.
NOTE: This will automatically use IO::Uncompress::Bunzip2 or IO::Uncompress::Gunzip to uncompress the file if it has a .bz2 or .gz extension.
This will return "undef" if the file cannot be opened.
NOTE: This will automatically use IO::Uncompress::Bunzip2 or IO::Uncompress::Gunzip to uncompress the file if it has a .bz2 or .gz extension.
An exception will be thrown if any part fails.
The source code repository for Test2-Harness can be found at http://github.com/Test-More/Test2-Harness/.
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/
2023-03-12 | perl v5.36.0 |