blib/lib/Text/Trac/LinkResolver/Attachment.pm

filter: Statementstmt 100% 20 / 20 Branchbran 50.0% 2 / 4 Conditioncond 60.0% 3 / 5 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 2 totaltotal 79.4% 31 / 39 SCAR 16.2
CC
5
Cov
86%
format_link
5.3
BEGIN
1.0
BEGIN
1.0
CRAP 5.1
« blib/lib/Text/Trac/LinkResolver/Comment.pm ↑ Summary blib/lib/Text/Trac/LinkResolver/Milestone.pm »
1 package Text::Trac::LinkResolver::Attachment;
2  
3 48 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 48 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 48 ▶use base qw( Text::Trac::LinkResolver );
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 48 our $VERSION = '0.23';
8  
9 sub init {
10 5462 ▶ my $self = shift;
Subroutine init: called CC=1 SCAR=0.0
Pod undocumented
11 }
12  
13 sub format_link {
14 5 ▶ my ( $self, $match, $target, $label ) = @_;
Subroutine format_link: called CC=5 SCAR=16.7
Pod undocumented
15 5 ▶ return $match if $self->_is_disabled;
Branch: 1 branch
BranchTrueFalseTotal
if $self->_is_disabled 0 5 5
16  
17 5 my $c = $self->{context};
18 5 ▶ $label ||= $match;
Condition33%1/3
$label ||= $match
l!l&&r!l&&!r
500
MC/DC0%0/2
$label ||= $match
$label $match
Truth table33%1/3
A ||= B
A= $labelB= $match
ABresult
1X1
011
000
19  
20 5 my ( $type, $name, $file ) = ( $match =~ m/attachment:([^:]+):([^:]+):([^:\]\s]+)/ );
21 5 ▶ my $url = $c->{trac_attachment_url} || $c->trac_url . 'attachment/';
Condition100%2/2
$c->{'trac_attachment_url'} || $c->trac_url . 'attachment/'
l!l
14
MC/DC100%1/1
$c->{'trac_attachment_url'} || $c->trac_url . 'attachment/'
$c->{'trac_attachment_url'}
Truth table100%2/2
A
A= $c->{'trac_attachment_url'}
Aresult
11
00
22 5 $url .= "$type/$name/$file";
23  
24 5 ▶ return sprintf '<a %s href="%s">%s</a>', ( $c->{class} ? q{class="attachment"} : '' ), $url, $label;
Branch: 1 branch
BranchTrueFalseTotal
$c->{'class'} ? : 5 0 5
25 }
26  
27 48 1;
« blib/lib/Text/Trac/LinkResolver/Comment.pm ↑ Summary blib/lib/Text/Trac/LinkResolver/Milestone.pm »