File Coverage

blib/lib/match/simple/XS.pm
Criterion Covered Total %
statement 16 17 94.1
branch 0 2 0.0
condition n/a
subroutine 6 7 85.7
pod n/a
total 22 26 84.6


line stmt bran cond sub pod time code
1             package match::simple::XS;
2              
3 3     3   172335 use 5.008000;
  3         11  
  3         127  
4 3     3   21 use strict;
  3         6  
  3         109  
5 3     3   28 use warnings;
  3         8  
  3         16115  
6              
7             our $AUTHORITY = 'cpan:TOBYINK';
8             our $VERSION = '0.001';
9              
10             require Carp;
11             require XSLoader;
12             XSLoader::load('match::simple::XS', $VERSION);
13              
14 10     10   19306 sub _regexp { scalar($_[0] =~ $_[1]) }
15              
16             if ($] >= 5.010)
17             {
18 3 0   3   46 eval q[
  3     3   8  
  3     0   187  
  3         20065  
  3         9770  
  3         226  
  0            
19             no warnings;
20             use overload ();
21             sub _smartmatch {
22             overload::Method($_[1], "~~")
23             ? !!( $_[0] ~~ $_[1] )
24             : Carp::croak("match::simple::XS cannot match")
25             }
26             ];
27             }
28             else
29             {
30             eval q[
31             sub _smartmatch {
32             Carp::croak("match::simple::XS cannot match")
33             }
34             ];
35             }
36              
37             1;
38             __END__
39              
40             =head1 NAME
41              
42             match::simple::XS - XS backend for match::simple
43              
44             =head1 SYNOPSIS
45              
46             use match::simple;
47              
48             =head1 DESCRIPTION
49              
50             Nothing to see here; move along.
51              
52             =head1 SEE ALSO
53              
54             L<match::simple>.
55              
56             =head1 AUTHOR
57              
58             Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
59              
60             =head1 THANKS
61              
62             Thanks to alh, bulk88, rafl, leont, and ilmari on the I<< #xs >> IRC
63             channel for helping me translate a bunch ideas from Perl to XS.
64              
65             The XS source code for L<Scalar::Util> was also very useful.
66              
67             =head1 COPYRIGHT AND LICENCE
68              
69             This software is copyright (c) 2014 by Toby Inkster.
70              
71             This is free software; you can redistribute it and/or modify it under
72             the same terms as the Perl 5 programming language system itself.
73              
74             =head1 DISCLAIMER OF WARRANTIES
75              
76             THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
77             WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
78             MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
79