File Coverage

blib/lib/Enbld/Target/Attribute/Filename.pm
Criterion Covered Total %
statement 25 25 100.0
branch 4 4 100.0
condition n/a
subroutine 6 6 100.0
pod 0 1 0.0
total 35 36 97.2


line stmt bran cond sub pod time code
1             package Enbld::Target::Attribute::Filename;
2              
3 3     3   7681 use strict;
  3         7  
  3         111  
4 3     3   22 use warnings;
  3         5  
  3         90  
5              
6 3     3   12 use Carp;
  3         4  
  3         166  
7              
8 3     3   13 use parent qw/Enbld::Target::AttributeExtension::Word/;
  3         4  
  3         16  
9              
10             sub initialize {
11 54     54 0 155 my ( $self, $param ) = @_;
12              
13 54 100       171 if ( ! defined $param ) {
14             $self->{callback} = sub {
15 30     30   47 my $attributes = shift;
16              
17 30         117 my $filename = $attributes->ArchiveName . "-";
18 30         136 $filename .= $attributes->Version . '.' . $attributes->Extension;
19              
20 30         88 return $filename;
21 47         324 };
22              
23 47         104 return $self;
24             }
25              
26 7 100       11 if ( $param ) {
27 6         28 $self->SUPER::initialize( $param );
28 6         9 return $self;
29             }
30              
31 1         4 require Enbld::Exception;
32 1         5 croak( Enbld::Exception->new( "Attribute 'Filename' isn't defined" ) );
33             }
34              
35             1;