blib/lib/Perl/Dist/Inno/File.pm

filter: Statementstmt 95.1% 39 / 41 Branchbran 50.0% 8 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 10 / 10 Podpod 0.0% 0 / 2 totaltotal 82.6% 57 / 69 CC 9 SCAR 13.1
CC
9
Cov
82%
as_string
6.9
new
4.3
BEGIN
1.0
CRAP 3.7
« blib/lib/Perl/Dist/Asset/Launcher.pm ↑ Summary blib/lib/Perl/Dist/Inno/Icon.pm »
1 package Perl::Dist::Inno::File;
2  
3 =pod
4  
5 =head1 NAME
6  
7 Perl::Dist::Inno::File - Inno Setup Script [Files] Section Entry
8  
9 =head1 DESCRIPTION
10  
11 The B<Perl::Dist::Inno::File> class provides a data class that represents
12 an entry in the [Files] section of the Inno Setup Script.
13  
14 =head1 METHODS
15  
16 =cut
17  
18 2 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 2 ▶use Carp qw{ croak };
Subroutine BEGIN: called CC=1 SCAR=0.0
22 2 ▶use Params::Util qw{ _IDENTIFIER _STRING };
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 2 ▶use vars qw{$VERSION};
Subroutine BEGIN: called CC=1 SCAR=0.0
25 2 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
26 2 $VERSION = '1.16';
27 }
28  
29 2 ▶use Object::Tiny qw{
Subroutine BEGIN: called CC=1 SCAR=0.0
30 source
31 dest_dir
32 ignore_version
33 recurse_subdirs
34 create_all_subdirs
35 is_readme
36 2 };
37  
38  
39  
40  
41  
42 #####################################################################
43 # Constructors
44  
45 1 ▶sub new {
Subroutine new: called CC=4 SCAR=14.7
Pod undocumented
46 1 my $self = shift->SUPER::new(@_);
47  
48 # Apply defaults
49 1 ▶ unless ( defined $self->ignore_version ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->ignore_version) 1 0 1
50 1 $self->{ignore_version} = 1;
51 }
52  
53 # Normalize params
54 1 $self->{ignore_version} = !! $self->ignore_version;
55 1 $self->{recurse_subdirs} = !! $self->recurse_subdirs;
56 1 $self->{create_all_subdirs} = !! $self->create_all_subdirs;
57 1 $self->{is_readme} = !! $self->is_readme;
58  
59 # Check params
60 1 ▶ unless ( _STRING($self->source) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&_STRING(scalar $self->source)) 0 1 1
61 0 croak("Missing or invalid source param");
62 }
63 1 ▶ unless ( _STRING($self->dest_dir) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&_STRING(scalar $self->dest_dir)) 0 1 1
64 0 croak("Missing or invalid dest_dir param");
65 }
66  
67 1 return $self;
68 }
69  
70  
71  
72  
73  
74 #####################################################################
75 # Main Methods
76  
77 1 ▶sub as_string {
Subroutine as_string: called CC=6 SCAR=19.3
Pod undocumented
78 1 my $self = shift;
79 1 my @flags = ();
80 1 ▶ push @flags, 'ignoreversion' if $self->ignore_version;
Branch: 1 branch
BranchTrueFalseTotal
if $self->ignore_version 1 0 1
81 1 ▶ push @flags, 'recursesubdirs' if $self->recurse_subdirs;
Branch: 1 branch
BranchTrueFalseTotal
if $self->recurse_subdirs 1 0 1
82 1 ▶ push @flags, 'createallsubdirs' if $self->create_all_subdirs;
Branch: 1 branch
BranchTrueFalseTotal
if $self->create_all_subdirs 1 0 1
83 1 ▶ push @flags, 'isreadme' if $self->is_readme;
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_readme 0 1 1
84 1 ▶ return join( '; ',
Branch: 1 branch
BranchTrueFalseTotal
scalar @flags ? : 1 0 1
85 "Source: \"" . $self->source . "\"",
86 "DestDir: \"" . $self->dest_dir . "\"",
87 (scalar @flags)
88 ? ("Flags: " . join(' ', @flags))
89 : (),
90 );
91 }
92  
93 2 1;
94  
95 =pod
96  
97 =head1 SUPPORT
98  
99 Bugs should be reported via the CPAN bug tracker at
100  
101 L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Perl-Dist>
102  
103 For other issues, contact the author.
104  
105 =head1 AUTHOR
106  
107 Adam Kennedy E<lt>adamk@cpan.orgE<gt>
108  
109 =head1 SEE ALSO
110  
111 L<Perl::Dist>
112  
113 =head1 COPYRIGHT
114  
115 Copyright 2007 - 2009 Adam Kennedy.
116  
117 This program is free software; you can redistribute
118 it and/or modify it under the same terms as Perl itself.
119  
120 The full text of the license can be found in the
121 LICENSE file included with this module.
122  
123 =cut
« blib/lib/Perl/Dist/Asset/Launcher.pm ↑ Summary blib/lib/Perl/Dist/Inno/Icon.pm »