| 1 | package CPAN::Search::Tester; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | $CPAN::Search::Tester::VERSION = '0.04'; | |||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | $CPAN::Search::Tester::AUTHORITY = 'cpan:MANWAR'; | |||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | CPAN::Search::Tester - Interface to search CPAN module tester. | ||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | Version 0.04 | ||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 2 | ▶ | use 5.006; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 2 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 2 | ▶ | use WWW::Mechanize; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | 2 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 2 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | 2 | my $URL = 'http://stats.cpantesters.org/cpanmail.html'; | |||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | This module is a very thin wrapper for "Find A Tester" feature provided by cpantesters.org. | ||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 4 | ▶ | has 'browser' => (is => 'ro', default => sub { return new WWW::Mechanize(autocheck => 1); }); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | =head2 search() | ||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | Search a CPAN Tester for the given ID or GUID. Please use with care and do *NOT* | ||||||||||||||||||||||||||||||||||||||||||
| 38 | generate spam attacks on testers. | ||||||||||||||||||||||||||||||||||||||||||
| 39 | Currently CPAN Testers reports are publicly available via CPAN Testers Reports | ||||||||||||||||||||||||||||||||||||||||||
| 40 | site, using a unique ID used by 'cpanstats' database or a GUID used by the | ||||||||||||||||||||||||||||||||||||||||||
| 41 | Metabase data store. Either of these can be used to perform a lookup. The ID or | ||||||||||||||||||||||||||||||||||||||||||
| 42 | GUID is displayed via the report display on the CPAN Testers Reports site. | ||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | For example, | ||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | http://www.cpantesters.org/cpan/report/7019327 | ||||||||||||||||||||||||||||||||||||||||||
| 47 | http://www.cpantesters.org/cpan/report/07019335-b19f-3f77-b713-d32bba55d77f | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | Here 7019327 is the ID and 07019335-b19f-3f77-b713-d32bba55d77f is the GUID. | ||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | use strict; use warnings; | ||||||||||||||||||||||||||||||||||||||||||
| 52 | use CPAN::Search::Tester; | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | print CPAN::Search::Tester->new->search('7019327') . "\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 55 | print CPAN::Search::Tester->new->search('07019335-b19f-3f77-b713-d32bba55d77f') . "\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | sub search { | ||||||||||||||||||||||||||||||||||||||||||
| 60 | 4 | ▶ | my ($self, $param) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
search: called CC=6 SCAR=29.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 4 | ▶ | die "ERROR: Invalid ID or GUID received." | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
defined $param and $param =~ /^\d+$/ || $param =~ /^[a-z0-9]+\-[a-z0-9]+\-[a-z0-9]+\-[a-z0-9]+\-[a-z0-9]+$/
$param =~ /^\d+$/ or $param =~ /^[a-z0-9]+\-[a-z0-9]+\-[a-z0-9]+\-[a-z0-9]+\-[a-z0-9]+$/
MC/DC0%0/3
defined $param and $param =~ /^\d+$/ || $param =~ /^[a-z0-9]+\-[a-z0-9]+\-[a-z0-9]+\-[a-z0-9]+\-[a-z0-9]+$/
defined $param
$param =~ /^\d+$/
$param =~ /^[a-z0-9]+\-[a-z0-9]+\-[a-z0-9]+\-[a-z0-9]+\-[a-z0-9]+$/
Truth table50%2/4
A and B or C
A= defined $paramB= $param =~ /^\d+$/C= $param =~ /^[a-z0-9]+\-[a-z0-9]+\-[a-z0-9]+\-[a-z0-9]+\-[a-z0-9]+$/
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | unless (defined $param | ||||||||||||||||||||||||||||||||||||||||||
| 64 | && | ||||||||||||||||||||||||||||||||||||||||||
| 65 | (($param =~ /^\d+$/) | ||||||||||||||||||||||||||||||||||||||||||
| 66 | || | ||||||||||||||||||||||||||||||||||||||||||
| 67 | ($param =~ /^[a-z0-9]+\-[a-z0-9]+\-[a-z0-9]+\-[a-z0-9]+\-[a-z0-9]+$/))); | ||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | $self->{browser}->get($URL); | |||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | $self->{browser}->form_number(1); | |||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | $self->{browser}->field('id', $param); | |||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | $self->{browser}->submit(); | |||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | my $content = $self->{browser}->content; | |||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | return "No data found.\n" unless defined $content; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | ($content =~ /\<tr\>\<th\>Address\:\<\/th\>\<td\>(.*)\<\/td\>\<\/tr\>/) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | ? | ||||||||||||||||||||||||||||||||||||||||||
| 78 | (return $1) | ||||||||||||||||||||||||||||||||||||||||||
| 79 | : | ||||||||||||||||||||||||||||||||||||||||||
| 80 | (return "No data found.\n"); | ||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | Mohammad S Anwar, C<< <mohammad.anwar at yahoo.com> >> | ||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | =head1 REPOSITORY | ||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | L<https://github.com/Manwar/CPAN-Search-Tester> | ||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | =head1 BUGS | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | Please report any bugs or feature requests to C<bug-cpan-search-tester at rt.cpan.org>, | ||||||||||||||||||||||||||||||||||||||||||
| 94 | or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CPAN-Search-Tester>. | ||||||||||||||||||||||||||||||||||||||||||
| 95 | I will be notified and then you'll automatically be notified of progress on your | ||||||||||||||||||||||||||||||||||||||||||
| 96 | bug as I make changes. | ||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | =head1 SUPPORT | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | You can find documentation for this module with the perldoc command. | ||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | perldoc CPAN::Search::Tester | ||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||
| 104 | You can also look for information at: | ||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | =item * RT: CPAN's request tracker | ||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=CPAN-Search-Tester> | ||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | L<http://annocpan.org/dist/CPAN-Search-Tester> | ||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | =item * CPAN Ratings | ||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | L<http://cpanratings.perl.org/d/CPAN-Search-Tester> | ||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | =item * Search CPAN | ||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | L<http://search.cpan.org/dist/CPAN-Search-Tester/> | ||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | =head1 ACKNOWLEDGEMENT | ||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | This wouldn't have been possible without the service of cpantesters.org. | ||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | =head1 LICENSE AND COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | Copyright (C) 2011 - 2015 Mohammad S Anwar. | ||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||
| 134 | This program is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||||||
| 135 | the terms of the the Artistic License (2.0). You may obtain a copy of the full | ||||||||||||||||||||||||||||||||||||||||||
| 136 | license at: | ||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | L<http://www.perlfoundation.org/artistic_license_2_0> | ||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | Any use, modification, and distribution of the Standard or Modified Versions is | ||||||||||||||||||||||||||||||||||||||||||
| 141 | governed by this Artistic License.By using, modifying or distributing the Package, | ||||||||||||||||||||||||||||||||||||||||||
| 142 | you accept this license. Do not use, modify, or distribute the Package, if you do | ||||||||||||||||||||||||||||||||||||||||||
| 143 | not accept this license. | ||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | If your Modified Version has been derived from a Modified Version made by someone | ||||||||||||||||||||||||||||||||||||||||||
| 146 | other than you,you are nevertheless required to ensure that your Modified Version | ||||||||||||||||||||||||||||||||||||||||||
| 147 | complies with the requirements of this license. | ||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | This license does not grant you the right to use any trademark, service mark, | ||||||||||||||||||||||||||||||||||||||||||
| 150 | tradename, or logo of the Copyright Holder. | ||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||
| 152 | This license includes the non-exclusive, worldwide, free-of-charge patent license | ||||||||||||||||||||||||||||||||||||||||||
| 153 | to make, have made, use, offer to sell, sell, import and otherwise transfer the | ||||||||||||||||||||||||||||||||||||||||||
| 154 | Package with respect to any patent claims licensable by the Copyright Holder that | ||||||||||||||||||||||||||||||||||||||||||
| 155 | are necessarily infringed by the Package. If you institute patent litigation | ||||||||||||||||||||||||||||||||||||||||||
| 156 | (including a cross-claim or counterclaim) against any party alleging that the | ||||||||||||||||||||||||||||||||||||||||||
| 157 | Package constitutes direct or contributory patent infringement,then this Artistic | ||||||||||||||||||||||||||||||||||||||||||
| 158 | License to you shall terminate on the date that such litigation is filed. | ||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND | ||||||||||||||||||||||||||||||||||||||||||
| 161 | CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED | ||||||||||||||||||||||||||||||||||||||||||
| 162 | WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR | ||||||||||||||||||||||||||||||||||||||||||
| 163 | NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS | ||||||||||||||||||||||||||||||||||||||||||
| 164 | REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, | ||||||||||||||||||||||||||||||||||||||||||
| 165 | INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE | ||||||||||||||||||||||||||||||||||||||||||
| 166 | OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||
| 168 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | 2 | 1; # End of CPAN::Search::Tester | |||||||||||||||||||||||||||||||||||||||||