blib/lib/Config/Model/Role/Utils.pm

filter: Statementstmt 100% 21 / 21 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod n/a totaltotal 100% 31 / 31 CC 2 SCAR 2.0
CC
2
Cov
100%
_resolve_arg_shortcut
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« blib/lib/Config/Model/Backend/PerlFile.pm ↑ Summary blib/lib/Config/Model/Role/HelpAsText.pm »
1 #
2 # This file is part of Config-Model
3 #
4 # This software is Copyright (c) 2005-2022 by Dominique Dumont.
5 #
6 # This is free software, licensed under:
7 #
8 # The GNU Lesser General Public License, Version 2.1, February 1999
9 #
10 package Config::Model::Role::Utils 2.169;
11  
12 # ABSTRACT: Provide some utilities
13  
14 59 ▶use Mouse::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 59 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 59 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 59 ▶use 5.020;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 59 ▶use feature qw/signatures postderef/;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 59 ▶no warnings qw/experimental::signatures experimental::postderef/;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 41611 ▶sub _resolve_arg_shortcut ($args, @param_list) {
Subroutine _resolve_arg_shortcut: called CC=2 SCAR=6.9
23 return $args->@* > @param_list ? $args->@*
24 41611 ▶ : map { $_ => shift @$args; } @param_list;
Branch: 1 branch
BranchTrueFalseTotal
@$args > @param_list ? : 33656 7955 41611
25 }
26  
27 3769 ▶sub _split_string ($str) {
Subroutine _split_string: called CC=1 SCAR=0.0
28 # do a split on ' ' but take quoted string into account
29 return (
30 3769 $str =~ m/
31 ( # begin of *one* command
32 (?: # group parts of a command (e.g ...:...=... )
33 (?:[^\s"']+) # match anything but a space and a quote
34 |
35 (?: # begin quoted group
36 " # begin of a string
37 (?: # begin group
38 \\" # match an escaped quote
39 | # or
40 [^"] # anything but a quote
41 )*? # lots of time
42 " # end of the string
43 ) # end of quoted group
44 | # match if I got more than one group
45 (?: # begin quoted group
46 ' # begin of a string
47 (?: # begin group
48 \\' # match an escaped quote
49 | # or
50 [^'] # anything but a quote
51 )*? # lots of time
52 ' # end of the string
53 ) # end of quoted group
54 # match if I got more than one group
55 )+ # can have several parts in one command
56 ) # end of *one* command
57 /gx # 'g' means that all commands are fed into @command array
58 ); #"asdf ;
59 }
60  
61  
62 59 1;
63  
64 __END__
« blib/lib/Config/Model/Backend/PerlFile.pm ↑ Summary blib/lib/Config/Model/Role/HelpAsText.pm »