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   10490 use strict;
  3         7  
  3         104  
4 3     3   14 use warnings;
  3         4  
  3         71  
5              
6 3     3   14 use Carp;
  3         5  
  3         190  
7              
8 3     3   15 use parent qw/Enbld::Target::AttributeExtension::Word/;
  3         5  
  3         17  
9              
10             sub initialize {
11 54     54 0 186 my ( $self, $param ) = @_;
12              
13 54 100       170 if ( ! defined $param ) {
14             $self->{callback} = sub {
15 30     30   56 my $attributes = shift;
16              
17 30         148 my $filename = $attributes->ArchiveName . "-";
18 30         154 $filename .= $attributes->Version . '.' . $attributes->Extension;
19              
20 30         108 return $filename;
21 47         468 };
22              
23 47         168 return $self;
24             }
25              
26 7 100       18 if ( $param ) {
27 6         36 $self->SUPER::initialize( $param );
28 6         14 return $self;
29             }
30              
31 1         5 require Enbld::Exception;
32 1         8 croak( Enbld::Exception->new( "Attribute 'Filename' isn't defined" ) );
33             }
34              
35             1;