Zonema...aseSet(3pm)
β¨ Zonemaster::CLI::TestCaseSet β¨
okay bestie, welcome to the Zonemaster::CLI::TestCaseSet page β it's a 3pm number from the User Contributed Perl Documentation crew, and it's literally all about managing and modifying your Zonemaster test case selections. yes, we're doing set math today. no, it's not that deep. let's go π¦
π NAME π
Zonemaster::CLI::TestCaseSet β manage and modify Zonemaster test case selections. that's the whole job description, she's booked and busy π
πΈ SYNOPSIS πΈ
use Zonemaster::CLI::TestCaseSet;
# Define the names of the available test modules and their test cases
my $schema = {
alpha => [qw( alpha01 alpha02 alpha03 )],
beta => [qw( beta01 beta02 )],
};
# Construct an initial selection of test cases
my $selection = Zonemaster::CLI::TestCaseSet->new(
[qw( alpha01 alpha02 alpha03 beta01 )],
$schema,
);
# Parse and apply a modifier expression
my @modifiers = Zonemaster::CLI::TestCaseSet->parse_modifier_expr( '-alpha+alpha02' );
while ( @modifiers ) {
my ( $op, $term ) = splice @modifiers, 0, 2;
$selection->apply_modifier( $op, $term )
or die "Error: Unrecognized term '$term'.\n";
}
# Output final test case selection
print join( ' ', $selection->to_list ); # alpha02 beta01
like, look at her go. that last line spits out alpha02 beta01 and honestly? ate. π₯
π DESCRIPTION π
Zonemaster::CLI::TestCaseSet is giving mutable selection of test cases energy β she can be changed, she can be shaped β paired up with an immutable schema that defines which test modules exist and which test cases belong to each one. the schema stays put. the selection does the moving. it's a whole dynamic, iykyk.
the schema is defined as a mapping of test module names to their associated test case names. that's it, that's the structure.
and the selection can be adjusted using modifier expressions, which is the fun part, so let's get into it π
π MODIFIER EXPRESSIONS π
a modifier expression is just, like, a description of a change you want to make to the current selection. you combine terms using operators β for example, -alpha+alpha02. cute, right? little string, big power.
these operators are supported:
'+'(union) β add test cases to the current selection. the set of test cases to add is the expansion of$term. so, like, more stuff please β¨'-'(difference) β remove test cases from the current selection. the set of test cases to remove is the expansion of$term. bye girl, not you anymore π''(replace) β replace the current selection. the new selection is the set of test cases expanded from$term. full glow-up, old selection who? never met her.
and here's the thing β terms expand into sets of test cases in one of three ways:
"all"β expands to all available test cases defined by the schema. the entire roster, no crumbs left π«Ά- Test module name β expands to all test cases associated with that test module. one module, all her children.
- Test case name β expands directly to the specified test case itself. test cases may be specified plainly (e.g.,
"Case10") or fully qualified (module/testcase, e.g.,"Case/Case10"). yes, both formats are valid, she's flexible like that π
term matching is case-insensitive. so don't stress about your shift key, bestie, she's not judging.
π§ CONSTRUCTORS π§
new( $selection, $schema )
construct a brand new TestCaseSet object. fresh out the box, main character energy from day one π
$selection(arrayref) β initial selection of test case names. your starting lineup β$schema(hashref) β a hash mapping test module names to arrays of their associated test case names. the rulebook, the blueprint, the canon.
dies if: β any test case name in$schemais repeated. β$selectioncontains names not found in$schema.
ok so like, do not be sloppy with your schema. duplicate test case names? gone. a selection name that doesn't exist in the schema? also gone. she will literally end the program over it and honestly, fair. boundaries π
β CLASS METHODS β
parse_modifier_expr( $modifier_expr )
parse a string containing a modifier expression and returns a list of alternating operators and terms.
the returned list always starts with an operator. no exceptions, no edge cases, that's just the format bestie.
for example, parsing '-alpha+beta02' returns:
('-', 'alpha', '+', 'beta02')
see how it alternates? operator, term, operator, term. so satisfying. so tidy. we love a predictable data structure πΈ
π INSTANCE METHODS π
apply_modifier( $operator, $term )
update the selection using the given operator and term. this is the one doing the actual work, the girl behind the scenes.
- returns true if successful β
- returns false if the term could not be expanded based on the schema β
- dies if the operator is invalid π
example:
$selection->apply_modifier('+', 'beta')
or die "Unrecognized term";
see that or die? that's you catching the false. do not skip the or die, bestie, that's how you end up confused at 2am π
to_list
return a lowercase list of the currently selected test case names. lowercase. all of it. every time. she doesn't do caps, that's just her aesthetic π
and that's the page!! every option, every operator, every "dies if", every return value β all of it, no crumbs left behind, periodt π«Ά
this lil rewrite is based on the Perl v5.40.1 docs, dated 2025-12-23 β shoutout to the original Zonemaster::CLI::TestCaseSet(3pm) page from User Contributed Perl Documentation for the facts, and to you for reading all the way to the bottom. mwah π
π¦ where this page comes from
- ubuntu resolute: zonemaster-cli 8.0.1-1 Β· BSD-2-Clause
- ubuntu stonking: zonemaster-cli 8.0.1-1 Β· BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms