blib/lib/Term/Fabulous/Event/ViewChange.pm untested

filter: Statementstmt 0.0% 0 / 47 Branchbran 0.0% 0 / 22 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 0.0% 0 / 7 Podpod n/a totaltotal 0.0% 0 / 96 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Term::Fabulous::Event::ViewChange;
2  
3 use v5.32;
4 use warnings;
5 use feature 'signatures';
6 no warnings 'experimental::signatures';
7  
8 our $VERSION = '0.05';
9  
10 use Object::Pad 0.825;
11  
12 use Clay::UI::Events::Event;
13  
14 class Term::Fabulous::Event::ViewChange :isa(Clay::UI::Events::Event) :strict(params) {
15 use Term::Fabulous::Check qw(non_negative_integer string);
16  
17 field $top :param :reader = undef;
18 field $bottom :param :reader = undef;
19 field $section :param :reader = undef;
20 field $section_title :param :reader = undef;
21 field $percent :param :reader = 0;
22 field $link :param :reader = undef;
23 field $query :param :reader = undef;
24 field $match :param :reader = undef;
25 field $matches :param :reader = 0;
26  
27 ADJUST {
28 $top = non_negative_integer( $self, top => $top ) if defined $top;
29 $bottom = non_negative_integer( $self, bottom => $bottom ) if defined $bottom;
30 $section = non_negative_integer( $self, section => $section ) if defined $section;
31 $match = non_negative_integer( $self, match => $match ) if defined $match;
32 $section_title = string( $self, section_title => $section_title ) if defined $section_title;
33 die "Term::Fabulous::Event::ViewChange: section and section_title go together; give both or neither" if defined $section != defined $section_title;
34 $percent = non_negative_integer( $self, percent => $percent );
35 $matches = non_negative_integer( $self, matches => $matches );
36 die "Term::Fabulous::Event::ViewChange: percent must be at most 100, got $percent" if $percent > 100;
37 die "Term::Fabulous::Event::ViewChange: match $match lies beyond the $matches matches" if defined $match && ( $match < 1 || $match > $matches );
38  
39 # A search may find nothing, but every match is of a search.
40 $query = string( $self, query => $query ) if defined $query;
41 die "Term::Fabulous::Event::ViewChange: query must not be empty" if defined $query && !length $query;
42 die "Term::Fabulous::Event::ViewChange: $matches matches without a query" unless defined $query || !$matches;
43 }
44  
45 method event_name :common () {
46 return 'ViewChange';
47 }
48 }
49  
50 1;
51  
52 __END__