FreeProxy/Samair.pm

filter: Statementstmt 25.0% 4 / 16 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 1 / 2 Podpod 100% 1 / 1 totaltotal 24.0% 6 / 25 CC 5 SCAR 32.3
CC
5
Cov
18%
fetch
30.0
BEGIN
1.0
CRAP 25.2
↑ Summary FreeProxy/Proxy4Free.pm »
1 package WWW::FreeProxy::Samair;
2  
3 1 ▶use LWP::Simple;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 =head1 FUNCTIONS
6  
7 =head2 fetch
8  
9 Fetches proxy list
10  
11 =cut
12  
13 0 ▶sub fetch {
Subroutine fetch: not called CC=5 SCAR=34.0
Pod documented
14 0 my ($self, $callback) = @_;
15 0 for (1 .. 10) {
16 0 (my $p = $_) =~ s/^\d$/0$&/;
17 0 my $c = get "http://www.samair.ru/proxy/proxy-$p.htm";
18 0 $c =~ s{<script type="text/javascript">}{<script>}g;
19 0 $c =~ m{<script>\s*((\w=\d;)+)</script>}s;
20 0 my ($s, %h) = $1;
21 0 ▶ $h{$1} = $2 while $s =~ /(\w)=(\d)/g;
Branch: 1 branch
BranchTrueFalseTotal
$s =~ /(\w)=(\d)/g and do { $h{$1} = $2 } 0 0 0
22 0 ▶ while ($c =~ m{<td>((?:\d+\.){3}\d+)<script>document\.write\(":"((?:\+\w)+)\)</script>}g) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c =~ m[<td>((?:\d+\.){3}\d+)<script>document\.write\(":"((?:\+\w)+)\)</script>]g) 0 0 0
23 0 my ($i, $n, $r) = ($1, $2);
24 0 ▶ $r .= $h{$1} while $n =~ /\+(\w)/g;
Branch: 1 branch
BranchTrueFalseTotal
$n =~ /\+(\w)/g and do { $r .= $h{$1} } 0 0 0
25 0 &$callback("$i:$r");
26 }
27 }
28 }
29  
30 1 1;
31  
32 =head1 COPYRIGHT & LICENSE
33  
34 Copyright 2008 Alexey Alexandrov, all rights reserved.
35  
36 This program is free software; you can redistribute it and/or modify it
37 under the same terms as Perl itself.
38  
39 =cut
↑ Summary FreeProxy/Proxy4Free.pm »