blib/lib/Data/Path/XS.pm

filter: Statementstmt 100% 34 / 34 Branchbran 100% 6 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 100% 45 / 45 CC 5 SCAR 11.7
CC
5
Cov
100%
import
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.2
↑ Summary XS.xs »
1 package Data::Path::XS;
2 21 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 21 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 21 our $VERSION = '0.04';
6  
7 21 ▶use parent 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 21 our @EXPORT_OK = qw(path_get path_set path_delete path_exists
9 patha_get patha_set patha_delete patha_exists
10 path_compile pathc_get pathc_set pathc_delete pathc_exists);
11  
12 21 require XSLoader;
13 21 XSLoader::load('Data::Path::XS', $VERSION);
14  
15 # Custom import to handle both Exporter and keyword hints
16 35 ▶sub import {
Subroutine import: called CC=5 SCAR=16.1
17 35 my $class = shift;
18 35 my @args = @_;
19  
20 # Check for :keywords tag
21 35 my $enable_keywords = 0;
22 35 my @export_args;
23 35 for my $arg (@args) {
24 146 ▶ if ($arg eq ':keywords') {
Branch: 1 branch
BranchTrueFalseTotal
if ($arg eq ':keywords') { } 19 127 146
25 19 $enable_keywords = 1;
26 } else {
27 127 push @export_args, $arg;
28 }
29 }
30  
31 # Enable keyword hints if requested
32 35 ▶ if ($enable_keywords) {
Branch: 1 branch
BranchTrueFalseTotal
if ($enable_keywords) 19 16 35
33 19 $^H{"Data::Path::XS/pathget"} = 1;
34 19 $^H{"Data::Path::XS/pathset"} = 1;
35 19 $^H{"Data::Path::XS/pathdelete"} = 1;
36 19 $^H{"Data::Path::XS/pathexists"} = 1;
37 }
38  
39 # Forward to Exporter for function exports
40 35 ▶ if (@export_args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@export_args) 16 19 35
41 16 $class->export_to_level(1, $class, @export_args);
42 }
43 }
44  
45 1 ▶sub unimport {
Subroutine unimport: called CC=1 SCAR=0.0
46 1 my $class = shift;
47 1 delete $^H{"Data::Path::XS/pathget"};
48 1 delete $^H{"Data::Path::XS/pathset"};
49 1 delete $^H{"Data::Path::XS/pathdelete"};
50 1 delete $^H{"Data::Path::XS/pathexists"};
51 }
52  
53 21 1;
54  
55 __END__
↑ Summary XS.xs »