GenHtml/Text.pm

filter: Statementstmt 59.3% 19 / 32 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 62.5% 5 / 8 Podpod 100% 1 / 1 totaltotal 60.9% 25 / 41 CC 1 SCAR 3.2
CC
1
Cov
59%
__ANON__
2.0
_get_nav_buttons_html
2.0
get_total_html
2.0
CRAP 1.4
« GenHtml.pm ↑ Summary GenHtml/ArrowImages.pm »
1 package HTML::Latemp::NavLinks::GenHtml::Text;
2 1 $HTML::Latemp::NavLinks::GenHtml::Text::VERSION = '0.2.9';
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use parent 'HTML::Latemp::NavLinks::GenHtml';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8  
9 1 __PACKAGE__->mk_accessors(
10 qw(
11 nav_links
12 )
13 );
14  
15 1 ▶use Template;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 # load Template::Stash to make method tables visible
18 1 ▶use Template::Stash;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 # Define a method to return a substring.
21 0 ▶$Template::Stash::SCALAR_OPS->{'substr'} = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
22 0 return substr( $_[0], $_[1], $_[2] );
23 1 };
24  
25 sub _get_nav_buttons_html
26 0 ▶{
Subroutine _get_nav_buttons_html: not called CC=1 SCAR=6.9
27 0 my $self = shift;
28  
29 0 my (%args) = (@_);
30  
31 0 my $with_accesskey = $args{'with_accesskey'};
32  
33 0 my $root = $self->root();
34  
35 0 my $template = Template->new(
36 {
37 'POST_CHOMP' => 1,
38 }
39 );
40  
41 0 my $vars = {
42 'buttons' => $self->_get_buttons(),
43 'root' => $root,
44 'with_accesskey' => $with_accesskey,
45 };
46  
47 0 my $nav_links_template = <<'EOF';
48 [% USE HTML %]
49 [% FOREACH b = buttons %]
50 [% SET key = b.dir.substr(0, 1) %]
51 <li>[
52 [% IF b.exists %]
53 <a href="[% HTML.escape(b.link_obj.direct_url()) %]" title="[% b.title %] (Alt+[% key FILTER upper %])"
54 [% IF with_accesskey %]
55 accesskey="[% key %]"
56 [% END %]
57 >[% END %] [% b.dir %] [% IF b.exists %]</a>
58 [% END %]
59 ]</li>
60 [% END %]
61 EOF
62  
63 0 my $nav_buttons_html = "";
64  
65 0 $template->process( \$nav_links_template, $vars, \$nav_buttons_html );
66 0 return $nav_buttons_html;
67 }
68  
69 sub get_total_html
70 0 ▶{
Subroutine get_total_html: not called CC=1 SCAR=6.9
Pod documented
71 0 my $self = shift;
72  
73 return
74 0 "<ul class=\"nav_links\">\n"
75 . $self->_get_nav_buttons_html(@_)
76 . "\n</ul>";
77 }
78  
79 1 1;
80  
81 __END__
« GenHtml.pm ↑ Summary GenHtml/ArrowImages.pm »