| 1 | package Data::Unixish::lcfirst; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use 5.010; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use syntax 'each_on_array'; # to support perl < 5.12 | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | #use Log::Any '$log'; | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use Data::Unixish::Util qw(%common_args); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 2 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |||||||||||||||||||||||||||
| 12 | 2 | our $DATE = '2025-02-24'; # DATE | |||||||||||||||||||||||||||
| 13 | 2 | our $DIST = 'Data-Unixish'; # DIST | |||||||||||||||||||||||||||
| 14 | 2 | our $VERSION = '1.574'; # VERSION | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 2 | our %SPEC; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | $SPEC{lcfirst} = { | ||||||||||||||||||||||||||||
| 19 | 2 | v => 1.1, | |||||||||||||||||||||||||||
| 20 | summary => 'Convert first character of text to lowercase', | ||||||||||||||||||||||||||||
| 21 | description => <<'MARKDOWN', | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | MARKDOWN | ||||||||||||||||||||||||||||
| 24 | args => { | ||||||||||||||||||||||||||||
| 25 | %common_args, | ||||||||||||||||||||||||||||
| 26 | }, | ||||||||||||||||||||||||||||
| 27 | tags => [qw/text itemfunc/], | ||||||||||||||||||||||||||||
| 28 | }; | ||||||||||||||||||||||||||||
| 29 | 1 | ▶ | sub lcfirst { | ||||||||||||||||||||||||||
|
Subroutine
lcfirst: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 30 | 1 | my %args = @_; | |||||||||||||||||||||||||||
| 31 | 1 | my ($in, $out) = ($args{in}, $args{out}); | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 1 | ▶ | while (my ($index, $item) = each @$in) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 34 | 5 | push @$out, _lcfirst_item($item); | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 1 | [200, "OK"]; | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 10 | ▶ | sub _lcfirst_item { | ||||||||||||||||||||||||||
|
Subroutine
_lcfirst_item: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 41 | 10 | my $item = shift; | |||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 10 | ▶ | if (defined($item) && !ref($item)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $item and not ref $item
MC/DC50%1/2
defined $item and not ref $item
defined $item
not ref $item
Truth table66%2/3
A and not(B)
A= defined $itemB= not ref $item
| |||||||||||||||||||||||||||||
| 44 | 8 | $item = CORE::lcfirst($item); | |||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | 10 | return $item; | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 2 | 1; | |||||||||||||||||||||||||||
| 50 | # ABSTRACT: Convert first character of text to lowercase | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | __END__ | ||||||||||||||||||||||||||||