line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MediaWiki::Bot::Constants; |
2
|
50
|
|
|
50
|
|
298
|
use strict; |
|
50
|
|
|
|
|
104
|
|
|
50
|
|
|
|
|
10695
|
|
3
|
50
|
|
|
50
|
|
310
|
use warnings; |
|
50
|
|
|
|
|
87
|
|
|
50
|
|
|
|
|
3248
|
|
4
|
|
|
|
|
|
|
# ABSTRACT: constants for MediaWiki::Bot |
5
|
|
|
|
|
|
|
our $VERSION = '5.006000'; # VERSION |
6
|
|
|
|
|
|
|
|
7
|
50
|
|
|
50
|
|
380
|
use MediaWiki::API; # How to grab these constants? |
|
50
|
|
|
|
|
98
|
|
|
50
|
|
|
|
|
8462
|
|
8
|
|
|
|
|
|
|
use Constant::Generate { |
9
|
50
|
|
|
|
|
5067
|
ERR_NO_ERROR => MediaWiki::API->ERR_NO_ERROR, |
10
|
|
|
|
|
|
|
ERR_CONFIG => MediaWiki::API->ERR_CONFIG, |
11
|
|
|
|
|
|
|
ERR_HTTP => MediaWiki::API->ERR_HTTP, |
12
|
|
|
|
|
|
|
ERR_API => MediaWiki::API->ERR_API, |
13
|
|
|
|
|
|
|
ERR_LOGIN => MediaWiki::API->ERR_LOGIN, |
14
|
|
|
|
|
|
|
ERR_EDIT => MediaWiki::API->ERR_EDIT, |
15
|
|
|
|
|
|
|
ERR_PARAMS => MediaWiki::API->ERR_PARAMS, |
16
|
|
|
|
|
|
|
ERR_UPLOAD => MediaWiki::API->ERR_UPLOAD, |
17
|
|
|
|
|
|
|
ERR_DOWNLOAD => MediaWiki::API->ERR_DOWNLOAD, |
18
|
|
|
|
|
|
|
ERR_CAPTCHA => 10, |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
RET_TRUE => !!1, |
21
|
|
|
|
|
|
|
RET_FALSE => !!0, |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
PAGE_NONEXISTENT => -1, |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
FILE_NONEXISTENT => 0, |
26
|
|
|
|
|
|
|
FILE_LOCAL => 1, |
27
|
|
|
|
|
|
|
FILE_SHARED => 2, |
28
|
|
|
|
|
|
|
FILE_PAGE_TEXT_ONLY => 3, |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
NS_USER => 2, |
31
|
|
|
|
|
|
|
NS_FILE => 6, |
32
|
|
|
|
|
|
|
NS_CATEGORY => 14, |
33
|
|
|
|
|
|
|
|
34
|
50
|
|
|
50
|
|
52275
|
};#, dualvar => 1; |
|
50
|
|
|
|
|
882959
|
|
35
|
|
|
|
|
|
|
|
36
|
50
|
|
|
50
|
|
35668
|
use Exporter qw(import); |
|
50
|
|
|
|
|
108
|
|
|
50
|
|
|
|
|
11173
|
|
37
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
38
|
|
|
|
|
|
|
err => [qw( |
39
|
|
|
|
|
|
|
ERR_NO_ERROR |
40
|
|
|
|
|
|
|
ERR_CONFIG |
41
|
|
|
|
|
|
|
ERR_HTTP |
42
|
|
|
|
|
|
|
ERR_API |
43
|
|
|
|
|
|
|
ERR_LOGIN |
44
|
|
|
|
|
|
|
ERR_EDIT |
45
|
|
|
|
|
|
|
ERR_PARAMS |
46
|
|
|
|
|
|
|
ERR_UPLOAD |
47
|
|
|
|
|
|
|
ERR_DOWNLOAD |
48
|
|
|
|
|
|
|
ERR_CAPTCHA |
49
|
|
|
|
|
|
|
)], |
50
|
|
|
|
|
|
|
bool => [qw( RET_TRUE RET_FALSE )], |
51
|
|
|
|
|
|
|
page => [qw( PAGE_NONEXISTENT )], |
52
|
|
|
|
|
|
|
file => [qw( FILE_NONEXISTENT FILE_LOCAL FILE_SHARED FILE_PAGE_TEXT_ONLY )], |
53
|
|
|
|
|
|
|
ns => [qw( NS_USER NS_FILE NS_CATEGORY )], |
54
|
|
|
|
|
|
|
); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Exporter::export_tags(qw(err)); |
57
|
|
|
|
|
|
|
Exporter::export_ok_tags(qw(bool page file ns)); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
{ |
60
|
|
|
|
|
|
|
my %seen; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
push @{$EXPORT_TAGS{all}}, |
63
|
|
|
|
|
|
|
grep {!$seen{$_}++} @{$EXPORT_TAGS{$_}} foreach keys %EXPORT_TAGS; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
__END__ |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=pod |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=encoding UTF-8 |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 NAME |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
MediaWiki::Bot::Constants - constants for MediaWiki::Bot |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 VERSION |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
version 5.006000 |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 SYNOPSIS |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
use MediaWiki::Bot; |
86
|
|
|
|
|
|
|
use MediaWiki::Bot::Constants qw(:file); |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
my $bot = MediaWiki::Bot->new(); |
89
|
|
|
|
|
|
|
my $file_existence = $bot->test_image_exists("File:..."); |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# Make sense of MediaWiki::Bot's random numbers |
92
|
|
|
|
|
|
|
if ($file_existence == FILE_LOCAL) { |
93
|
|
|
|
|
|
|
# Get from local media repository |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
elsif ($file_existence == FILE_SHARED) { |
96
|
|
|
|
|
|
|
# Get from shared (remote) media repository |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 DESCRIPTION |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Exportable constants used by L<MediaWiki::Bot>. Use these constants |
102
|
|
|
|
|
|
|
in your code to avoid the use of magical numbers, and to ensure |
103
|
|
|
|
|
|
|
compatibility with future changes in C<MediaWiki::Bot>. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
You can also import C<:constants> or any constant name(s) from |
106
|
|
|
|
|
|
|
L<MediaWiki::Bot>: |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
use MediaWiki::Bot qw(:constants); |
109
|
|
|
|
|
|
|
use MediaWiki::Bot qw(PAGE_NONEXISTENT); |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 CONSTANTS |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
The available constants are divided into 5 tags, which can be imported |
114
|
|
|
|
|
|
|
individually: |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=over 4 |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=item * |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
err - the error constants, inherited from L<MediaWiki::API> |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=item * |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
bool - boolean constants |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=item * |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
page - page existence |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=item * |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
file - file (image/media) existence status (which is not boolean) |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=item * |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
ns - some namespace numbers. B<Achtung!> Incomplete! Use L<MediaWiki::Bot>'s |
137
|
|
|
|
|
|
|
functions for getting namespace information for your wiki. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=back |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 EXPORTS |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
No symbols are exported by default. The available tags are err, bool, page, file, ns, and all. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head1 AVAILABILITY |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
The project homepage is L<https://metacpan.org/module/MediaWiki::Bot>. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
The latest version of this module is available from the Comprehensive Perl |
150
|
|
|
|
|
|
|
Archive Network (CPAN). Visit L<http://www.perl.com/CPAN/> to find a CPAN |
151
|
|
|
|
|
|
|
site near you, or see L<https://metacpan.org/module/MediaWiki::Bot/>. |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 SOURCE |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
The development version is on github at L<http://github.com/doherty/MediaWiki-Bot> |
156
|
|
|
|
|
|
|
and may be cloned from L<git://github.com/doherty/MediaWiki-Bot.git> |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
You can make new bug reports, and view existing ones, through the |
161
|
|
|
|
|
|
|
web interface at L<http://rt.cpan.org>. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head1 AUTHORS |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=over 4 |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=item * |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Dan Collins <dcollins@cpan.org> |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=item * |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Mike.lifeguard <lifeguard@cpan.org> |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=item * |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Alex Rowe <alex.d.rowe@gmail.com> |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=item * |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Oleg Alexandrov <oleg.alexandrov@gmail.com> |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=item * |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
jmax.code <jmax.code@gmail.com> |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=item * |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Stefan Petrea <stefan.petrea@gmail.com> |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=item * |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
kc2aei <kc2aei@gmail.com> |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=item * |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
bosborne@alum.mit.edu |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=item * |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
Brian Obio <brianobio@gmail.com> |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=item * |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
patch and bug report contributors |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=back |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
This software is Copyright (c) 2014 by the MediaWiki::Bot team <perlwikibot@googlegroups.com>. |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
This is free software, licensed under: |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
The GNU General Public License, Version 3, June 2007 |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=cut |