ControlBreak
view release on metacpan or search on metacpan
Note that the level numbers set by test(...) are true if there was a
level change, and false if there wasn't. So, they can be used as a
simple boolean test of whether there was a change. Or you can use the
break() method to determine whether any control break has occurred.
Because level numbers correspond to the hierarchical data order, they
can be use to trigger multiple actions; e.g. levelnum() >= 1 could be
used to print subtotals for levels 1 whenever a control break occurred
for level 1, 2 or 3. It is usually the case that higher control breaks
are meant to cascade to lower control levels and this can be achieved in
this fashion. The break() method simplifies this.
Note that method continue() must be called at the end of each iteration
in order to save the values of the iteration for the next iteration. If
not, the next test(...) invocation will croak.
test_and_do ( $var1 [, $var2 ]... $var_end, $coderef )
The test_and_do() method is similar to test(). It takes the same
arguments as test(), plus one additional argument that is an anonymous
code reference. Internally, it calls test() and then, if there is a
lib/ControlBreak.pm view on Meta::CPAN
Note that the level numbers set by B<test(...)> are true if there was
a level change, and false if there wasn't. So, they can be used as a
simple boolean test of whether there was a change. Or you can use
the B<break()> method to determine whether any control break has
occurred.
Because level numbers correspond to the hierarchical data order, they
can be use to trigger multiple actions; e.g. B<levelnum()> >= 1 could
be used to print subtotals for levels 1 whenever a control break
occurred for level 1, 2 or 3. It is usually the case that higher
control breaks are meant to cascade to lower control levels and this
can be achieved in this fashion. The B<break()> method simplifies
this.
Note that method B<continue()> must be called at the end of each
iteration in order to save the values of the iteration for the next
iteration. If not, the next B<test(...)> invocation will croak.
=cut
method test (@args) {
( run in 0.518 second using v1.01-cache-2.11-cpan-49f99fa48dc )