lib/TUI/Help/RefTable.pm

filter: Statementstmt 100% 77 / 77 Branchbran 56.2% 9 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 19 / 19 Podpod 60.0% 6 / 10 totaltotal 90.9% 111 / 122 CC 9 SCAR 6.5
CC
9
Cov
92%
build
4.2
BUILD
3.1
readItem
2.0
CRAP 1.9
« script/overview.pl ↑ Summary lib/TUI/StdDlg/Dos.pm »
1 package TUI::Help::RefTable;
2 # ABSTRACT: sorted symbol table of help-topic references
3
4 9 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7
8 9 our $VERSION = '2.000003';
9 9 $VERSION =~ tr/_//d;
10 9 our $AUTHORITY = 'cpan:BRICKPOOL';
11
12 9 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
13 9 our @EXPORT = qw(
14 TRefTable
15 new_TRefTable
16 );
17
18 9 ▶use Storable;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 9 ▶use TUI::toolkit;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 9 ▶use TUI::toolkit::Types qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
21 is_Object
22 is_Str
23 :types
24 9 );
25
26 9 ▶use TUI::Help::HelpBase;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 9 ▶use TUI::Objects::SortedCollection;
Subroutine BEGIN: called CC=1 SCAR=0.0
28
29 sub TRefTable() { __PACKAGE__ }
30 sub name() { 'TRefTable' }
31 4 ▶sub new_TRefTable { __PACKAGE__->from(@_) }
Subroutine new_TRefTable: called CC=1 SCAR=0.0
Pod documented
32
33 9 extends TSortedCollection;
34
35 #
36 # TRefTable is a symbol table of TReference objects. Unseen topics create
37 # unresolved entries; previously seen topics retain their current values.
38 # Forward-reference fix-up lists are not represented in this port.
39 #
40 6 ▶sub BUILDARGS { # \%args (%args)
Subroutine BUILDARGS: called CC=1 SCAR=0.0
Pod documented
41 6 state $sig = signature(
42 method => 1,
43 named => [
44 limit => Int, { alias => 'aLimit' },
45 delta => Int, { alias => 'aDelta' },
46 ],
47 caller_level => +1,
48 );
49 6 my ( $class, $args ) = $sig->( @_ );
50 6 return { %$args };
51 }
52
53 6 ▶sub BUILD { # void (\%args)
Subroutine BUILD: called CC=3 SCAR=11.2
Pod documented
54 6 my ( $self, $args ) = @_;
55 6 ▶ assert ( @_ == 2 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 6 6
56 6 ▶ assert ( is_Object $self );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($self) 0 6 6
57 6 $self->{shouldDelete} = true;
58 6 return;
59 }
60
61 4 ▶sub from { # $table ($aLimit, $aDelta)
Subroutine from: called CC=1 SCAR=0.0
Pod undocumented
62 4 state $sig = signature(
63 method => 1,
64 pos => [Int, Int],
65 );
66 4 my ( $class, $aLimit, $aDelta ) = $sig->( @_ );
67 4 return $class->new( limit => $aLimit, delta => $aDelta );
68 }
69
70 22 ▶sub compare { # $cmp ($key1, $key2)
Subroutine compare: called CC=1 SCAR=0.0
Pod documented
71 22 state $sig = signature(
72 method => Object,
73 pos => [Str, Str],
74 );
75 22 my ( $self, $key1, $key2 ) = $sig->( @_ );
76 22 return $key1 cmp $key2;
77 }
78
79 14 ▶sub getReference { # $reference ($topic)
Subroutine getReference: called CC=2 SCAR=6.9
Pod documented
80 14 state $sig = signature(
81 method => Object,
82 pos => [Str],
83 );
84 14 my ( $self, $topic ) = $sig->( @_ );
85 14 my $i;
86 14 ▶ return $self->at( $i )
Branch: 1 branch
BranchTrueFalseTotal
if $self->search($topic, \$i) 2 12 14
87 if $self->search( $topic, \$i );
88
89 12 my $ref = TReference->new(
90 topic => $topic,
91 resolved => false,
92 val => 0,
93 );
94 12 $self->insert( $ref );
95 12 return $ref;
96 }
97
98 34 ▶sub keyOf { # $topic ($item)
Subroutine keyOf: called CC=1 SCAR=0.0
Pod documented
99 34 state $sig = signature(
100 method => Object,
101 pos => [Object],
102 );
103 34 my ( $self, $item ) = $sig->( @_ );
104 34 return $item->topic;
105 }
106
107 2 ▶sub readItem { # undef ($is)
Subroutine readItem: called CC=2 SCAR=7.0
Pod undocumented
108 2 state $sig = signature(
109 method => Object,
110 pos => [Object],
111 );
112 2 my ( $self, $is ) = $sig->( @_ );
113 2 ▶ assert ( Storable::is_retrieving );
Branch: 1 branch
BranchTrueFalseTotal
unless &Storable::is_retrieving() 0 2 2
114 2 return undef;
115 }
116
117 2 ▶sub writeItem { # void ($item, $os)
Subroutine writeItem: called CC=2 SCAR=7.0
Pod undocumented
118 2 state $sig = signature(
119 method => Object,
120 pos => [Item, Object],
121 );
122 2 my ( $self, $item, $os ) = $sig->( @_ );
123 2 ▶ assert ( Storable::is_storing );
Branch: 1 branch
BranchTrueFalseTotal
unless &Storable::is_storing() 0 2 2
124 2 return;
125 }
126
127 1 ▶sub build { # $table ()
Subroutine build: called CC=4 SCAR=14.2
Pod undocumented
128 1 my ( $class ) = @_;
129 1 ▶ assert ( @_ == 1 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 1 0 1 1
130 1 ▶ assert ( is_Str $class );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Str($class) 0 1 1
131 1 ▶ assert ( Storable::is_retrieving );
Branch: 1 branch
BranchTrueFalseTotal
unless &Storable::is_retrieving() 0 1 1
132 1 return $class->new( limit => 0, delta => 0 );
133 }
134
135 9 1
136
137 __END__
« script/overview.pl ↑ Summary lib/TUI/StdDlg/Dos.pm »