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