| 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
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table0%0/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 46 | :"$2way" # unless it should get -way instead | ||||||||||||||||||||
| 47 | /iegx; | ||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | 1 | return $_; | |||||||||||||||||||
| 50 | } | ||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | 1 | 1; | |||||||||||||||||||
| 54 | __END__ | ||||||||||||||||||||