blib/lib/getaddress.pm

filter: Statementstmt 77.0% 37 / 48 Branchbran 30.0% 3 / 10 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 77.7% 7 / 9 Podpod 0.0% 0 / 1 totaltotal 65.7% 48 / 73 CC 7 SCAR 13.8
CC
7
Cov
67%
AUTOLOAD
8.2
ipwhere
5.5
__ANON__
2.0
CRAP 4.0
↑ Summary const-c.inc »
1 package getaddress;
2  
3 1 ▶use 5.006001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 require Exporter;
9 1 ▶use AutoLoader;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 our @ISA = qw(Exporter);
12  
13 # Items to export into callers namespace by default. Note: do not export
14 # names by default without a very good reason. Use EXPORT_OK instead.
15 # Do not simply export all your public functions/methods/constants.
16  
17 # This allows declaration use getaddress ':all';
18 # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
19 # will save memory.
20 1 our %EXPORT_TAGS = ( 'all' => [ qw(
21
22 ) ] );
23  
24 1 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
25  
26 1 our @EXPORT = qw(
27 ipwhere
28 );
29  
30 1 our $VERSION = '0.04';
31  
32 0 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: not called CC=3 SCAR=21.1
33 # This AUTOLOAD is used to 'autoload' constants from the constant()
34 # XS function.
35  
36 0 my $constname;
37 0 our $AUTOLOAD;
38 0 ($constname = $AUTOLOAD) =~ s/.*:://;
39 0 ▶ croak "&getaddress::constant not defined" if $constname eq 'constant';
Branch: 1 branch
BranchTrueFalseTotal
if $constname eq "constant" 0 0 0
40 0 my ($error, $val) = constant($constname);
41 0 ▶ if ($error) { croak $error; }
Branch: 1 branch
BranchTrueFalseTotal
if ($error) 0 0 0
42 {
43 0 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.2
44 # Fixed between 5.005_53 and 5.005_61
45 #XXX if ($] >= 5.00561) {
46 #XXX *$AUTOLOAD = sub () { $val };
47 #XXX }
48 #XXX else {
49 0 ▶ *$AUTOLOAD = sub { $val };
Subroutine __ANON__: not called CC=1 SCAR=6.9
50 #XXX }
51 }
52 0 goto &$AUTOLOAD;
53 }
54  
55 1 require XSLoader;
56 1 XSLoader::load('getaddress', $VERSION);
57  
58 # Preloaded methods go here.
59 sub ipwhere
60 1 ▶{
Subroutine ipwhere: called CC=5 SCAR=17.0
Pod undocumented
61 1 my $ip = shift;
62 1 my $ipfile = shift;
63 1 ▶ $ipfile = "data/QQWry.Dat" unless ($ipfile);
Branch: 1 branch
BranchTrueFalseTotal
unless $ipfile 0 1 1
64 1 my $ipaddr = getipwhere ($ipfile, $ip);
65 1 ▶ return 'δ֪µØÇø' unless ($ipaddr);
Branch: 1 branch
BranchTrueFalseTotal
unless $ipaddr 0 1 1
66 1 $ipaddr =~ s/CZ88\.NET//ig;
67 1 $ipaddr =~ s/^\s*//;
68 1 $ipaddr =~ s/\s*$//;
69 1 ▶ $ipaddr = 'δ֪µØÇø' if (!$ipaddr || $ipaddr =~ /δ֪|http/i);
Branch: 1 branch
BranchTrueFalseTotal
if not $ipaddr or $ipaddr =~ /\316\264\326\252|http/i 0 1 1
Condition33%1/3
not $ipaddr or $ipaddr =~ /\316\264\326\252|http/i
l!l&&r!l&&!r
001
MC/DC0%0/2
not $ipaddr or $ipaddr =~ /\316\264\326\252|http/i
not $ipaddr $ipaddr =~ /\316\264\326\252|http/i
Truth table33%1/3
not(A) or B
A= not $ipaddrB= $ipaddr =~ /\316\264\326\252|http/i
ABresult
1X1
011
000
70 1 return $ipaddr;
71 }
72  
73 # Autoload methods go after =cut, and are processed by the autosplit program.
74  
75 1 1;
76 __END__
↑ Summary const-c.inc »