blib/lib/String/KeyboardDistanceXS.pm

filter: Statementstmt 64.5% 31 / 48 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 66.6% 6 / 9 Podpod n/a totaltotal 51.3% 37 / 72 CC 7 SCAR 28.4
CC
7
Cov
51%
AUTOLOAD
35.4
__ANON__
2.0
__ANON__
2.0
CRAP 17.2
↑ Summary KeyboardDistanceXS.xs »
1 package String::KeyboardDistanceXS;
2  
3 1 require 5.005_62;
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 require DynaLoader;
10 1 ▶use AutoLoader;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 our @ISA = qw(Exporter DynaLoader);
13  
14 # Items to export into callers namespace by default. Note: do not export
15 # names by default without a very good reason. Use EXPORT_OK instead.
16 # Do not simply export all your public functions/methods/constants.
17  
18 # This allows declaration use String::KeyboardDistanceXS ':all';
19 # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
20 # will save memory.
21  
22 1 my @EXPORT_SUBS = qw(
23 qwertyKeyboardDistance
24 qwertyKeyboardDistanceMatch
25 );
26 1 our %EXPORT_TAGS = ( 'all' => [ @EXPORT_SUBS, qw(
27
28 ) ] );
29  
30 1 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
31  
32 1 our @EXPORT = qw(
33
34 );
35 1 our $VERSION = '0.02';
36  
37 0 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: not called CC=7 SCAR=35.7
38 # This AUTOLOAD is used to 'autoload' constants from the constant()
39 # XS function. If a constant is not found then control is passed
40 # to the AUTOLOAD in AutoLoader.
41  
42 0 my $constname;
43 0 our $AUTOLOAD;
44 0 ($constname = $AUTOLOAD) =~ s/.*:://;
45 0 ▶ croak "& not defined" if $constname eq 'constant';
Branch: 1 branch
BranchTrueFalseTotal
if $constname eq "constant" 0 0 0
46 0 ▶ my $val = constant($constname, @_ ? $_[0] : 0);
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
47 0 ▶ if ($! != 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($! != 0) 0 0 0
48 0 ▶ if ($! =~ /Invalid/ || $!{EINVAL}) {
Subroutine BEGIN: called CC=1 SCAR=2.6
Branch: 1 branch
BranchTrueFalseTotal
if ($! =~ /Invalid/ or $!{'EINVAL'}) { } 0 0 0
Condition0%0/3
$! =~ /Invalid/ or $!{"EINVAL"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$! =~ /Invalid/ or $!{"EINVAL"}
$! =~ /Invalid/ $!{"EINVAL"}
Truth table0%0/3
A or B
A= $! =~ /Invalid/B= $!{"EINVAL"}
ABresult
1X1
011
000
49 0 $AutoLoader::AUTOLOAD = $AUTOLOAD;
50 0 goto &AutoLoader::AUTOLOAD;
51 }
52 else {
53 0 croak "Your vendor has not defined String::KeyboardDistanceXS macro $constname";
54 }
55 }
56 {
57 0 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.2
58 # Fixed between 5.005_53 and 5.005_61
59 0 ▶ if ($] >= 5.00561) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] >= 5.00561) { } 0 0 0
60 0 ▶ *$AUTOLOAD = sub () { $val };
Subroutine __ANON__: not called CC=1 SCAR=6.9
61 }
62 else {
63 0 ▶ *$AUTOLOAD = sub { $val };
Subroutine __ANON__: not called CC=1 SCAR=6.9
64 }
65 }
66 0 goto &$AUTOLOAD;
67 }
68  
69 1 bootstrap String::KeyboardDistanceXS $VERSION;
70  
71  
72 1 my $initStatus = initQwertyMap();
73  
74  
75 # Preloaded methods go here.
76  
77 # Autoload methods go after =cut, and are processed by the autosplit program.
78  
79 1 1;
80 __END__
↑ Summary KeyboardDistanceXS.xs »