Test2:...ttings(3pm)

🌸 Test2:...ttings(3pm) 🌸

okay bestie, this is Test2::Harness::Settings β€” straight out of the User Contributed Perl Documentation manual, section 3pm, and yes the header truncates it to Test2:...ttings(3pm) because somebody let the title run off the edge of the page, iconic honestly πŸ’…


✨ NAME ✨

Test2::Harness::Settings β€” configuration settings for Test2::Harness. πŸ’–


πŸŽ€ DESCRIPTION πŸŽ€

So like. This module represents the options provided at the command line. That's its whole thing. 🫢

Each option has a prefix, and each prefix can be accessed from the settings. That's the vibe. That's the whole vibe.


πŸ¦‹ SYNOPSIS πŸ¦‹

# You will rarely if ever need to construct settings yourself, usually a
# component of Test2::Harness will expose them to you.
my $settings = $thing->settings;

# All prefixes have a method generated for them via AUTOLOAD
my $display = $settings->display;

# You can also use the prefix method
my $display = $settings->prefix('display');

# The prefix can be used in a similar way
my $verbose = $settings->display->verbose;

see how you basically never build these yourself? a component of Test2::Harness just hands them to you like a lil gift 🎁

For the full tea on how to actually use the prefixes, go look at Test2::Harness::Settings::Prefix. It's got more details.


πŸ‘‘ METHODS πŸ‘‘

heads up, bestie β€” note that any prefix that does not conflict with the predefined methods can be accessed via AUTOLOAD, which generates the methods on demand as needed. so like, magic, but the well-behaved kind ✨

  • $settings->define_prefix($prefix_name) β€” this is the one that creates a prefix. πŸ’–
  • $bool = $settings->check_prefix($prefix_name) β€” this is the one that checks whether a prefix is defined or not. Returns a bool, slays responsibly. βœ…
  • $prefix = $settings->prefix($prefix_name) $prefix = $settings->$prefix_name β€” this retrieves a prefix if it exists. if the prefix is not defined, this will throw an exception. 😭 so if you're not sure whether a prefix exists, use $settings-"check_prefix($prefix_name)>. no cap.
  • $thing = $settings->build($prefix_name, $class, @args) β€” this creates an instance of $class, passing the key/value pairs from the specified prefix as arguments. You can also toss in extra arguments via @args. πŸŽ€
  • $hashref = $settings->TO_JSON() β€” this method lets settings get serialized into JSON. that's it, that's the method. πŸ¦‹

πŸ“š SOURCE πŸ“š

The source code repository for Test2-Harness can be found at http://github.com/Test-More/Test2-Harness/. go star it, it's giving open source royalty πŸ‘‘


πŸ’œ 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!! 🫢 this lil manual page was brought to you by perl v5.40.1, dated 2026-05-10, and it's the Test2:...ttings(3pm) page all the way through. love that for us. bye mwah πŸ’…βœ¨πŸŒΈ

πŸ“¦ where this page comes from