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

filter: Statementstmt 96.0% 24 / 25 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 100% 1 / 1 totaltotal 94.4% 34 / 36 CC 2 SCAR 2.3
CC
2
Cov
93%
new
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« blib/lib/auto/share/dist/Perl-Dist/vanilla/perl-5.10.0/lib/CPAN/Config.pm ↑ Summary /home/cpancover/.cpan/CPAN/MyConfig.pm »
1 package Perl::Dist::Asset::File;
2  
3 =pod
4  
5 =head1 NAME
6  
7 Perl::Dist::Asset::File - "Single File" asset for a Win32 Perl
8  
9 =head1 SYNOPSIS
10  
11 my $binary = Perl::Dist::Asset::File->new(
12 url => 'http://host/path/file',
13 install_to => 'perl/foo.txt',
14 );
15  
16 =head1 DESCRIPTION
17  
18 B<Perl::Dist::Asset::File> is a data class that provides encapsulation
19 and error checking for a single file to be installed unmodified into a
20 L<Perl::Dist>-based Perl distribution.
21  
22 It is normally created on the fly by the <Perl::Dist::Inno> C<install_file>
23 method (and other things that call it).
24  
25 This asset exists to allow for cases where very small tweaks need to be
26 done to distributions by dropping in specific single files.
27  
28 The specification of the location to retrieve the package is done via
29 the standard mechanism implemented in L<Perl::Dist::Asset>.
30  
31 =head1 METHODS
32  
33 This class inherits from L<Perl::Dist::Asset> and shares its API.
34  
35 =cut
36  
37 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
38 2 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
39 2 ▶use Params::Util qw{ _STRING };
Subroutine BEGIN: called CC=1 SCAR=0.0
40 2 ▶use Perl::Dist::Asset ();
Subroutine BEGIN: called CC=1 SCAR=0.0
41  
42 2 ▶use vars qw{$VERSION @ISA};
Subroutine BEGIN: called CC=1 SCAR=0.0
43 2 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
44 2 $VERSION = '1.16';
45 2 @ISA = 'Perl::Dist::Asset';
46 }
47  
48 2 ▶use Object::Tiny qw{
Subroutine BEGIN: called CC=1 SCAR=0.0
49 install_to
50 2 };
51  
52  
53  
54  
55  
56 #####################################################################
57 # Constructor
58  
59 =pod
60  
61 =head2 new
62  
63 The C<new> constructor takes a series of parameters, validates then
64 and returns a new B<Perl::Dist::Asset::Binary> object.
65  
66 It inherits all the params described in the L<Perl::Dist::Asset> C<new>
67 method documentation, and adds some additional params.
68  
69 =over 4
70  
71 =item install_to
72  
73 The required C<install_to> param describes the location that the package
74 will be installed to.
75  
76 The C<install_to> param should be a simple string that represents the
77 entire destination path (including file name).
78  
79 =back
80  
81 The C<new> constructor returns a B<Perl::Dist::Asset::File> object,
82 or throws an exception (dies) if an invalid param is provided.
83  
84 =cut
85  
86 1 ▶sub new {
Subroutine new: called CC=2 SCAR=7.6
Pod documented
87 1 my $self = shift->SUPER::new(@_);
88  
89 # Check params
90 1 ▶ unless ( _STRING($self->install_to) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&_STRING(scalar $self->install_to)) 0 1 1
91 0 Carp::croak("Missing or invalid install_to param");
92 }
93  
94 1 return $self;
95 }
96  
97 2 1;
98  
99 =pod
100  
101 =head1 SUPPORT
102  
103 Bugs should be reported via the CPAN bug tracker at
104  
105 L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Perl-Dist>
106  
107 For other issues, contact the author.
108  
109 =head1 AUTHOR
110  
111 Adam Kennedy E<lt>adamk@cpan.orgE<gt>
112  
113 =head1 SEE ALSO
114  
115 L<Perl::Dist>, L<Perl::Dist::Inno>, L<Perl::Dist::Asset>
116  
117 =head1 COPYRIGHT
118  
119 Copyright 2007 - 2009 Adam Kennedy.
120  
121 This program is free software; you can redistribute
122 it and/or modify it under the same terms as Perl itself.
123  
124 The full text of the license can be found in the
125 LICENSE file included with this module.
126  
127 =cut
« blib/lib/auto/share/dist/Perl-Dist/vanilla/perl-5.10.0/lib/CPAN/Config.pm ↑ Summary /home/cpancover/.cpan/CPAN/MyConfig.pm »