line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
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 is a data class that provides encapsulation |
19
|
|
|
|
|
|
|
and error checking for a single file to be installed unmodified into a |
20
|
|
|
|
|
|
|
L-based Perl distribution. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
It is normally created on the fly by the C |
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. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 METHODS |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
This class inherits from L and shares its API. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=cut |
36
|
|
|
|
|
|
|
|
37
|
2
|
|
|
2
|
|
28945
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
51
|
|
38
|
2
|
|
|
2
|
|
8
|
use Carp (); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
32
|
|
39
|
2
|
|
|
2
|
|
960
|
use Params::Util qw{ _STRING }; |
|
2
|
|
|
|
|
6820
|
|
|
2
|
|
|
|
|
107
|
|
40
|
2
|
|
|
2
|
|
539
|
use Perl::Dist::Asset (); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
46
|
|
41
|
|
|
|
|
|
|
|
42
|
2
|
|
|
2
|
|
13
|
use vars qw{$VERSION @ISA}; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
141
|
|
43
|
|
|
|
|
|
|
BEGIN { |
44
|
2
|
|
|
2
|
|
10
|
$VERSION = '1.16'; |
45
|
2
|
|
|
|
|
66
|
@ISA = 'Perl::Dist::Asset'; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
2
|
|
|
|
|
9
|
use Object::Tiny qw{ |
49
|
|
|
|
|
|
|
install_to |
50
|
2
|
|
|
2
|
|
9
|
}; |
|
2
|
|
|
|
|
5
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
##################################################################### |
57
|
|
|
|
|
|
|
# Constructor |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=pod |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 new |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
The C constructor takes a series of parameters, validates then |
64
|
|
|
|
|
|
|
and returns a new B object. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
It inherits all the params described in the L C |
67
|
|
|
|
|
|
|
method documentation, and adds some additional params. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=over 4 |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item install_to |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
The required C param describes the location that the package |
74
|
|
|
|
|
|
|
will be installed to. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
The C param should be a simple string that represents the |
77
|
|
|
|
|
|
|
entire destination path (including file name). |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=back |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
The C constructor returns a B object, |
82
|
|
|
|
|
|
|
or throws an exception (dies) if an invalid param is provided. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub new { |
87
|
1
|
|
|
1
|
1
|
18
|
my $self = shift->SUPER::new(@_); |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
# Check params |
90
|
1
|
50
|
|
|
|
22
|
unless ( _STRING($self->install_to) ) { |
91
|
0
|
|
|
|
|
0
|
Carp::croak("Missing or invalid install_to param"); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
1
|
|
|
|
|
9
|
return $self; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=pod |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 SUPPORT |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Bugs should be reported via the CPAN bug tracker at |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
L |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
For other issues, contact the author. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 AUTHOR |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Adam Kennedy Eadamk@cpan.orgE |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 SEE ALSO |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
L, L, L |
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 |