blib/lib/Lingua/PigLatin.pm

filter: Statementstmt 91.3% 21 / 23 Branchbran 75.0% 3 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 80.0% 4 / 5 Podpod 0.0% 0 / 2 totaltotal 71.7% 28 / 39 CC 4 SCAR 11.0
CC
4
Cov
80%
new
6.0
piglatin
3.0
BEGIN
1.0
CRAP 3.0
↑ Summary
1 package Lingua::PigLatin;
2
3 1 ▶use 5.008008;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6
7 1 require Exporter;
8
9 1 our @ISA = qw(Exporter);
10
11 # Items to export into callers namespace by default. Note: do not export
12 # names by default without a very good reason. Use EXPORT_OK instead.
13 # Do not simply export all your public functions/methods/constants.
14
15 # This allows declaration use Lingua::PigLatin ':all';
16 # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
17 # will save memory.
18 1 our %EXPORT_TAGS = ( 'all' => [ qw(
19 piglatin
20 ) ] );
21
22 1 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
23
24 1 our @EXPORT = qw(
25
26 );
27
28 1 our $VERSION = '0.01';
29
30
31 # Preloaded methods go here.
32
33 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
34 0 my $class = shift;
35 0 ▶ bless {}, ref($class)||$class;
Condition0%0/3
ref $class || $class
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table0%0/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
36 }
37
38 1 ▶sub piglatin {
Subroutine piglatin: called CC=3 SCAR=11.0
Pod undocumented
39 1 local $_ = shift;
40 1 ▶ local $_ = shift if ref($_);
Branch: 1 branch
BranchTrueFalseTotal
if ref $_ 0 1 1
41
42 1 s/\b(qu|[cgpstw]h # First syllable, including digraphs
43 |[^\W0-9_aeiou]) # Unless it begins with a vowel or number
44 ?([a-z]+)/ # Store the rest of the word in a variable
45 11 ▶ $1?"$2$1ay" # move the first syllable and add -ay
Branch: 1 branch
BranchTrueFalseTotal
$1 ? : 10 1 11
46 :"$2way" # unless it should get -way instead
47 /iegx;
48
49 1 return $_;
50 }
51
52
53 1 1;
54 __END__
↑ Summary