File Coverage

blib/lib/Module/Release/UploadOwnSite.pm
Criterion Covered Total %
statement 12 30 40.0
branch 0 10 0.0
condition 0 3 0.0
subroutine 4 6 66.6
pod 1 2 50.0
total 17 51 33.3


line stmt bran cond sub pod time code
1             package Module::Release::UploadOwnSite;
2              
3 1     1   1539 use 5.006001;
  1         4  
  1         45  
4 1     1   7 use strict;
  1         2  
  1         27  
5 1     1   7 use warnings;
  1         2  
  1         36  
6 1     1   5 use parent qw(Exporter);
  1         11  
  1         10  
7              
8             our @EXPORT = qw(ownsite_upload ownsite_password);
9              
10             our $VERSION = '0.101';
11             $VERSION = eval { return $VERSION };
12              
13             =head1 NAME
14              
15             Module::Release::UploadOwnSite - Upload to personal site
16              
17             =head1 DESCRIPTION
18              
19             The release-csjewell script will automatically load this module if it thinks that you
20             want to upload to your own site.
21              
22             =head1 SYNOPSIS
23              
24             use Module::Release '2.00_04';
25              
26             # ...
27             $release->load_mixin( 'Module::Release::UploadOwnSite' );
28             $release->ownsite_password;
29             # ...
30             last if $release->debug;
31              
32             # ...
33             $release->ownsite_upload;
34              
35             =head1 INTERFACE
36              
37             =over 4
38              
39             =item ownsite_upload
40              
41             Looks in local_name to get the name and version of the distribution file.
42              
43             =cut
44              
45             sub ownsite_upload {
46 0     0 1   my $self = shift;
47              
48 0           my $host = $self->config->ownsite_ftp_host();
49 0 0         return unless $host;
50              
51 0           my $user = $self->config->ownsite_ftp_user();
52 0 0         return unless $user;
53              
54 0           my $dir = $self->config->ownsite_ftp_upload_dir();
55 0 0         return unless $dir;
56              
57 0           my $password = $self->config->ownsite_ftp_pass();
58 0 0         return unless $password;
59              
60 0           my $local_file = $self->local_file;
61              
62 0           $self->_print("Now uploading to $host\n");
63              
64 0           $self->ftp_upload(
65             user => $user,
66             password => $password,
67             upload_dir => $dir,
68             hostname => $host,
69             );
70              
71 0           return;
72             } ## end sub ownsite_upload
73              
74             sub ownsite_password {
75 0     0 0   my $self = shift;
76 0           my $pass;
77              
78 0 0 0       if ( $pass = $self->config->ownsite_ftp_pass()
79             || $self->get_env_var('FTP_PASS') )
80             {
81 0           $self->config->set( 'ownsite_ftp_pass', $pass );
82             }
83              
84 0           return;
85             } ## end sub ownsite_password
86              
87             =back
88              
89             =head1 SEE ALSO
90              
91             L<Module::Release>
92              
93             =head1 SOURCE AVAILABILITY
94              
95             This source is on the Open Repository:
96              
97             L<http://svn.ali.as/cpan/trunk/Module-Release-CSJEWELL/>
98              
99             =head1 CONFIGURATION AND ENVIRONMENT
100              
101             =head2 .releaserc or releaserc file
102              
103             These four entries are read from the releaserc file to configure where
104             the file is uploaded:
105              
106             ownsite_ftp_host ftp.host.invalid
107             ownsite_ftp_user ftpusername
108             ownsite_ftp_pass ftppassword
109             ownsite_ftp_upload_dir /public_html/perl
110              
111             These entries set what host the file is uploaded to, the username and
112             password to use, and the directory on the host to upload it to, respectively.
113              
114             All entries, except the ownsite_ftp_pass one, must be in the releaserc file,
115             or L</ownsite_upload> will return without uploading the file.
116              
117             =head2 Environment
118              
119             The FTP_PASS environment variable can be used instead of the
120             "ownsite_ftp_pass" variable, so that the releaserc file does not contain a
121             password.
122              
123             If neither the ownsite_ftp_pass releaserc entry nor the environment variable
124             was set, then the ownsite_password routine will request the password from the
125             console.
126              
127             =head1 AUTHOR
128              
129             Curtis Jewell, C<< <csjewell@cpan.org> >>
130              
131             =head1 LICENSE AND COPYRIGHT
132              
133             Copyright (c) 2009, Curtis Jewell C<< <csjewell@cpan.org> >>. All rights reserved.
134              
135             This module is free software; you can redistribute it and/or
136             modify it under the same terms as Perl itself, either version
137             5.8.1 or any later version. See L<perlartistic> and L<perlgpl>.
138              
139             The full text of the license can be found in the
140             LICENSE file included with this module.
141              
142             =head1 DISCLAIMER OF WARRANTY
143              
144             BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
145             FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
146             OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
147             PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
148             EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
149             WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
150             ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
151             YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
152             NECESSARY SERVICING, REPAIR, OR CORRECTION.
153              
154             IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
155             WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
156             REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE
157             LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
158             OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
159             THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
160             RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
161             FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
162             SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
163             SUCH DAMAGES.
164              
165             =cut
166              
167             1;