line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright 2009, 2010, 2011, 2013, 2016 Kevin Ryde |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# This file is part of Time-Duration-Locale. |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# Time-Duration-Locale is free software; you can redistribute it and/or |
6
|
|
|
|
|
|
|
# modify it under the terms of the GNU General Public License as published |
7
|
|
|
|
|
|
|
# by the Free Software Foundation; either version 3, or (at your option) any |
8
|
|
|
|
|
|
|
# later version. |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
# Time-Duration-Locale is distributed in the hope that it will be useful, |
11
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
13
|
|
|
|
|
|
|
# Public License for more details. |
14
|
|
|
|
|
|
|
# |
15
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License along |
16
|
|
|
|
|
|
|
# with Time-Duration-Locale. If not, see . |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# cf Lingua::FI::Kontti too |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
package Time::Duration::en_PIGLATIN; |
21
|
2
|
|
|
2
|
|
1479
|
use 5.004; |
|
2
|
|
|
|
|
8
|
|
22
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
63
|
|
23
|
2
|
|
|
2
|
|
997
|
use Time::Duration::Filter; # from => 'Time::Duration'; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
17
|
|
24
|
|
|
|
|
|
|
|
25
|
2
|
|
|
2
|
|
13
|
use vars '$VERSION'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
913
|
|
26
|
|
|
|
|
|
|
$VERSION = 12; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _filter { |
29
|
27
|
|
|
27
|
|
1797
|
my ($str) = @_; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# Could do something for apostrophe in the middle of a word, but that |
32
|
|
|
|
|
|
|
# doesn't arise from Time::Duration. |
33
|
27
|
|
|
|
|
163
|
$str =~ s{([[:alpha:]]+)}{ |
34
|
47
|
|
|
|
|
80
|
my $word = $1; |
35
|
47
|
|
|
|
|
41
|
my $ret; |
36
|
47
|
100
|
|
|
|
187
|
if ($word =~ /^(([bcdfghjklmnprstvwxz]|qu?)+)([aeiouy].*)/i) { |
|
|
100
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# leading consonants to end |
38
|
35
|
|
|
|
|
72
|
$ret = $3 . $1 . 'ay'; |
39
|
|
|
|
|
|
|
} elsif ($word =~ /[aeiouy]$/i) { |
40
|
|
|
|
|
|
|
# ending in a vowel |
41
|
8
|
|
|
|
|
11
|
$ret = $word . 'way'; |
42
|
|
|
|
|
|
|
} else { |
43
|
|
|
|
|
|
|
# ending in a consonant |
44
|
4
|
|
|
|
|
5
|
$ret = $word . 'ay'; |
45
|
|
|
|
|
|
|
} |
46
|
47
|
|
|
|
|
62
|
_follow_caps ($word, $ret); |
47
|
|
|
|
|
|
|
}egi; |
48
|
27
|
|
|
|
|
139
|
return $str; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# Return $str with upper, lower or ucfirst case following what $orig has. |
52
|
|
|
|
|
|
|
# If $orig is a single upper case char then it's treated as ucfirst. |
53
|
|
|
|
|
|
|
sub _follow_caps { |
54
|
47
|
|
|
47
|
|
52
|
my ($orig, $str) = @_; |
55
|
47
|
100
|
|
|
|
253
|
return ($orig =~ /^[[:upper:]](.*[[:lower:]]|$)/ ? ucfirst(lc($str)) |
|
|
100
|
|
|
|
|
|
56
|
|
|
|
|
|
|
: $orig =~ /[[:lower:]]/ ? lc($str) |
57
|
|
|
|
|
|
|
: uc($str)); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# Text::Bastardize 0.08 has a bug where pig() goes into an infinite loop on |
61
|
|
|
|
|
|
|
# a word with no vowels like a number "20" etc from Time::Duration ... |
62
|
|
|
|
|
|
|
# |
63
|
|
|
|
|
|
|
# use Text::Bastardize; |
64
|
|
|
|
|
|
|
# my $bastardizer = Text::Bastardize->new; |
65
|
|
|
|
|
|
|
# sub _pig { |
66
|
|
|
|
|
|
|
# my ($str) = @_; |
67
|
|
|
|
|
|
|
# $bastardizer->charge ($str); |
68
|
|
|
|
|
|
|
# return $bastardizer->pig; |
69
|
|
|
|
|
|
|
# } |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# use Time::Duration (); |
72
|
|
|
|
|
|
|
# use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
73
|
|
|
|
|
|
|
# |
74
|
|
|
|
|
|
|
# $VERSION = 7; |
75
|
|
|
|
|
|
|
# |
76
|
|
|
|
|
|
|
# use Exporter; |
77
|
|
|
|
|
|
|
# @ISA = ('Exporter'); |
78
|
|
|
|
|
|
|
# |
79
|
|
|
|
|
|
|
# @EXPORT = @Time::Duration::EXPORT; |
80
|
|
|
|
|
|
|
# @EXPORT_OK = @Time::Duration::EXPORT_OK; |
81
|
|
|
|
|
|
|
# %EXPORT_TAGS = (all => \@EXPORT_OK); |
82
|
|
|
|
|
|
|
# |
83
|
|
|
|
|
|
|
# foreach my $name (@EXPORT_OK) { |
84
|
|
|
|
|
|
|
# eval "sub $name { _pig (Time::Duration::$name (\@_)) }"; |
85
|
|
|
|
|
|
|
# } |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |
88
|
|
|
|
|
|
|
__END__ |