File Coverage

blib/lib/String/KeyboardDistanceXS.pm
Criterion Covered Total %
statement 18 35 51.4
branch 0 10 0.0
condition 0 3 0.0
subroutine 6 9 66.6
pod n/a
total 24 57 42.1


line stmt bran cond sub pod time code
1             package String::KeyboardDistanceXS;
2              
3             require 5.005_62;
4 1     1   842 use strict;
  1         2  
  1         42  
5 1     1   5 use warnings;
  1         3  
  1         36  
6 1     1   5 use Carp;
  1         1  
  1         243  
7              
8             require Exporter;
9             require DynaLoader;
10 1     1   982 use AutoLoader;
  1         2208  
  1         6  
11              
12             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             my @EXPORT_SUBS = qw(
23             qwertyKeyboardDistance
24             qwertyKeyboardDistanceMatch
25             );
26             our %EXPORT_TAGS = ( 'all' => [ @EXPORT_SUBS, qw(
27            
28             ) ] );
29              
30             our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
31              
32             our @EXPORT = qw(
33            
34             );
35             our $VERSION = '0.02';
36              
37             sub AUTOLOAD {
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     0     my $constname;
43 0           our $AUTOLOAD;
44 0           ($constname = $AUTOLOAD) =~ s/.*:://;
45 0 0         croak "& not defined" if $constname eq 'constant';
46 0 0         my $val = constant($constname, @_ ? $_[0] : 0);
47 0 0         if ($! != 0) {
48 1 0 0 1   1838 if ($! =~ /Invalid/ || $!{EINVAL}) {
  1         1529  
  1         75  
  0            
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 1     1   6 no strict 'refs';
  1         3  
  1         171  
  0            
58             # Fixed between 5.005_53 and 5.005_61
59 0 0         if ($] >= 5.00561) {
60 0     0     *$AUTOLOAD = sub () { $val };
  0            
61             }
62             else {
63 0     0     *$AUTOLOAD = sub { $val };
  0            
64             }
65             }
66 0           goto &$AUTOLOAD;
67             }
68              
69             bootstrap String::KeyboardDistanceXS $VERSION;
70              
71              
72             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;
80             __END__