1Test2::Harness::SettingUss(e3r)Contributed Perl DocumentTaetsito2n::Harness::Settings(3)
2
3
4
6 Test2::Harness::Settings - Configuration settings for Test2::Harness.
7
9 This module represents the options provided at the command line. Each
10 option has a prefix, and each prefix can be accessed from the settings.
11
13 # You will rarely if ever need to construct settings yourself, usually a
14 # component of Test2::Harness will expose them to you.
15 my $settings = $thing->settings;
16
17 # All prefixes have a method generated for them via AUTOLOAD
18 my $display = $settings->display;
19
20 # You can also use the prefix method
21 my $display = $settings->prefix('display');
22
23
24 # The prefix can be used in a similar way
25 my $verbose = $settings->display->verbose;
26
27 See Test2::Harness::Settings::Prefix for more details on how to use the
28 prefixes.
29
31 Note that any prefix that does not conflict with the predefined methods
32 can be accessed via AUTOLOAD generating the methods as needed.
33
34 $settings->define_prefix($prefix_name)
35 This is used to create a prefix.
36
37 $bool = $settings->check_prefix($prefix_name)
38 This is used to check if a prefix is defined or not.
39
40 $prefix = $settings->prefix($prefix_name)
41 $prefix = $settings->$prefix_name
42 This will retrieve a prefix if it exists. If the prefix is not
43 defined this will throw an exception. If you are unsure if a prefix
44 exists use "$settings-"check_prefix($prefix_name)>.
45
46 $thing = $settings->build($prefix_name, $class, @args)
47 This will create an instance of $class passing the key/value pairs
48 from the specified prefix as arguments. Additional arguments can be
49 provided in @args.
50
51 $hashref = $settings->TO_JSON()
52 This method allows settings to be serialized into JSON.
53
55 The source code repository for Test2-Harness can be found at
56 http://github.com/Test-More/Test2-Harness/.
57
59 Chad Granum <exodist@cpan.org>
60
62 Chad Granum <exodist@cpan.org>
63
65 Copyright 2020 Chad Granum <exodist7@gmail.com>.
66
67 This program is free software; you can redistribute it and/or modify it
68 under the same terms as Perl itself.
69
70 See http://dev.perl.org/licenses/
71
72
73
74perl v5.34.0 2021-11-05 Test2::Harness::Settings(3)