blib/lib/Jedi/Helpers/Scalar.pm

filter: Statementstmt 100% 24 / 24 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 100% 3 / 3 totaltotal 100% 37 / 37 SCAR 6.9
CC
2
Cov
100%
full_path
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
« blib/lib/Jedi/Helpers/Hash.pm ↑ Summary blib/lib/Jedi/App.pm »
1 #
2 # This file is part of Jedi
3 #
4 # This software is copyright (c) 2013 by celogeek <me@celogeek.com>.
5 #
6 # This is free software; you can redistribute it and/or modify it under
7 # the same terms as the Perl 5 programming language system itself.
8 #
9 package Jedi::Helpers::Scalar;
10  
11 # ABSTRACT: Jedi Helpers for Scalar
12  
13 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 9 our $VERSION = '1.007'; # VERSION
17  
18 9 ▶use Import::Into;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 9 ▶use Module::Runtime qw/use_module/;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 sub import {
22 13 ▶ my $target = caller;
Subroutine import: called CC=1 SCAR=0.0
23 13 use_module('autobox')->import::into( $target, SCALAR => __PACKAGE__ );
24 13 return;
25 }
26  
27 sub full_path {
28 309 ▶ my ($path) = @_;
Subroutine full_path: called CC=2 SCAR=6.9
Pod documented
29 309 ▶ $path .= '/' if substr( $path, -1 ) ne '/';
Branch: 1 branch
BranchTrueFalseTotal
if substr($path, -1) ne "/" 42 267 309
30 309 return $path;
31 }
32  
33 sub start_with {
34 30 ▶ my ( $path, $start ) = @_;
Subroutine start_with: called CC=1 SCAR=0.0
Pod documented
35 30 return substr( $path, 0, length($start) ) eq $start;
36 }
37  
38 sub without_base {
39 57 ▶ my ( $path, $base ) = @_;
Subroutine without_base: called CC=1 SCAR=0.0
Pod documented
40  
41 57 return substr( full_path($path), length( full_path($base) ) - 1 );
42 }
43  
44 9 1;
45  
46 __END__
« blib/lib/Jedi/Helpers/Hash.pm ↑ Summary blib/lib/Jedi/App.pm »