GenHtml/ArrowImages.pm

filter: Statementstmt 100% 42 / 42 Branchbran n/a Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 11 / 11 Podpod 100% 2 / 2 totaltotal 100% 58 / 58 CC 2 SCAR 1.5
CC
2
Cov
100%
_init
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« GenHtml/Text.pm ↑ Summary
1 package HTML::Latemp::NavLinks::GenHtml::ArrowImages;
2 2 $HTML::Latemp::NavLinks::GenHtml::ArrowImages::VERSION = '0.2.9';
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use vars qw($nav_buttons_html);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 ▶use parent 'HTML::Latemp::NavLinks::GenHtml';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 __PACKAGE__->mk_accessors(
11 qw(
12 _ext
13 )
14 );
15  
16 sub _init
17 2 ▶{
Subroutine _init: called CC=2 SCAR=6.9
18 2 my $self = shift;
19 2 my (%args) = (@_);
20  
21 2 $self->SUPER::_init(%args);
22  
23 2 ▶ $self->_ext( $args{ext} || '.png' );
Condition100%2/2
$args{'ext'} || '.png'
l!l
11
MC/DC100%1/1
$args{'ext'} || '.png'
$args{'ext'}
Truth table100%2/2
A
A= $args{'ext'}
Aresult
11
00
24  
25 2 return;
26 }
27  
28  
29 2 ▶use Template;
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 # load Template::Stash to make method tables visible
32 2 ▶use Template::Stash;
Subroutine BEGIN: called CC=1 SCAR=0.0
33  
34 # Define a method to return a substring.
35 6 ▶$Template::Stash::SCALAR_OPS->{'substr'} = sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
36 6 return substr( $_[0], $_[1], $_[2] );
37 2 };
38  
39 sub _get_nav_buttons_html
40 2 ▶{
Subroutine _get_nav_buttons_html: called CC=1 SCAR=0.0
41 2 my $self = shift;
42  
43 2 my (%args) = (@_);
44  
45 2 my $with_accesskey = $args{'with_accesskey'};
46  
47 2 my $root = $self->root();
48  
49 2 my $template = Template->new(
50 {
51 'POST_CHOMP' => 1,
52 }
53 );
54  
55 2 my $vars = {
56 'buttons' => $self->_get_buttons(),
57 'root' => $root,
58 'with_accesskey' => $with_accesskey,
59 'image_base' => $self->get_image_base(),
60 ext => $self->_ext(),
61 };
62  
63 2 my $nav_links_template = <<'EOF';
64 [% USE HTML %]
65 [% FOREACH b = buttons %]
66 [% SET key = b.dir.substr(0, 1) %]
67 <li>
68 [% IF b.exists %]
69 <a href="[% HTML.escape(b.link_obj.direct_url()) %]" title="[% b.title %] (Alt+[% key FILTER upper %])"
70 [% IF with_accesskey %]
71 accesskey="[% key %]"
72 [% END %]
73 >[% END %]<img src="[% root %]/images/[% image_base %][% b.button %][% UNLESS b.exists %]-disabled[% END %][% ext %]"
74 alt="[% b.title %]" class="bless" />[% IF b.exists %]</a>
75 [% END %]
76 </li>
77 [% END %]
78 EOF
79  
80 2 my $nav_buttons_html = "";
81  
82 2 $template->process( \$nav_links_template, $vars, \$nav_buttons_html );
83 2 return $nav_buttons_html;
84 }
85  
86  
87 sub get_image_base
88 2 ▶{
Subroutine get_image_base: called CC=1 SCAR=0.0
Pod documented
89 2 my $self = shift;
90  
91 2 return "arrow-";
92 }
93  
94  
95 sub get_total_html
96 2 ▶{
Subroutine get_total_html: called CC=1 SCAR=0.0
Pod documented
97 2 my $self = shift;
98  
99 return
100 2 "<ul class=\"nav_links\">\n"
101 . $self->_get_nav_buttons_html(@_)
102 . "\n</ul>";
103 }
104  
105 2 1;
106  
107 __END__
« GenHtml/Text.pm ↑ Summary