File Coverage

blib/lib/Ref/Util/XS.pm
Criterion Covered Total %
statement 15 22 68.1
branch 0 4 0.0
condition 0 3 0.0
subroutine 5 6 83.3
pod n/a
total 20 35 57.1


line stmt bran cond sub pod time code
1             package Ref::Util::XS;
2             # ABSTRACT: XS implementation for Ref::Util
3             $Ref::Util::XS::VERSION = '0.117';
4 10     10   435616 use strict;
  10         84  
  10         277  
5 10     10   41 use warnings;
  10         15  
  10         218  
6 10     10   38 use XSLoader;
  10         19  
  10         298  
7              
8 10     10   43 use Exporter 5.57 'import';
  10         205  
  10         1201  
9              
10             our %EXPORT_TAGS = ( 'all' => [qw<
11             is_ref
12             is_scalarref
13             is_arrayref
14             is_hashref
15             is_coderef
16             is_regexpref
17             is_globref
18             is_formatref
19             is_ioref
20             is_refref
21              
22             is_plain_ref
23             is_plain_scalarref
24             is_plain_arrayref
25             is_plain_hashref
26             is_plain_coderef
27             is_plain_globref
28             is_plain_formatref
29             is_plain_refref
30              
31             is_blessed_ref
32             is_blessed_scalarref
33             is_blessed_arrayref
34             is_blessed_hashref
35             is_blessed_coderef
36             is_blessed_globref
37             is_blessed_formatref
38             is_blessed_refref
39             >] );
40              
41             our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
42              
43             XSLoader::load('Ref::Util::XS', $Ref::Util::XS::{VERSION} ? ${ $Ref::Util::XS::{VERSION} } : ());
44              
45             if (_using_custom_ops()) {
46             for my $op (@{$EXPORT_TAGS{all}}) {
47 10     10   53 no strict 'refs';
  10         25  
  10         2332  
48             *{"B::Deparse::pp_$op"} = sub {
49 0     0     my ($deparse, $bop, $cx) = @_;
50 0           my @kids = $deparse->deparse($bop->first, 6);
51 0           my $sib = $bop->first->sibling;
52 0 0         if (ref $sib ne 'B::NULL') {
53 0           push @kids, $deparse->deparse($sib, 6);
54             }
55             my $prefix
56             = (
57             exists &{"$deparse->{curstash}::$op"}
58 0 0 0       && \&{"$deparse->{curstash}::$op"} == \&{__PACKAGE__.'::'.$op}
59             )
60             ? '' : (__PACKAGE__.'::');
61 0           return "$prefix$op(" . join(", ", @kids) . ")";
62             };
63             }
64             }
65              
66             1;
67              
68             __END__