Acme-Opish
view release on metacpan or search on metacpan
lib/Acme/Opish.pm view on Meta::CPAN
) # ...end capture.
/$prefix$1/gisx; # Add 'op' to what we captured.
} # }}}
# Special case 'ye'.
elsif (lc ($_) eq 'ye') {
$_ = 'y' . $prefix . substr ($_, -1);
}
# We don't want to prefix a non-vowel y.
elsif (/^y[aeiouy]/i) { # {{{
s/
(?:^y)? # Our string starts with y, but we don't
# want to consider it for every match.
( # Capture...
[aeiouy]+ # consecutive vowels
\B # that do not terminate at a word boundry
(?![aeiouy]) # that are not followed by another vowel
| # or
[aeiouy]* # any consecutive vowels
[aiouy] # with any non-e vowel following
\b # that terminates at a word boundry.
| # or
lib/Acme/Opish.pm view on Meta::CPAN
# Okay. Why not add anything you want, instead of "op"?
print enop(-opish_prefix => 'ubb', 'Foo bar?');
# Fubboo bubbar?
=head1 DESCRIPTION
Convert words to Opish, which is similar to "Ubish", but infinitely
cooler.
More accurately, this means, add an arbitrary prefix to the vowel
groups of words, except for the "silent e" and "starting, non-vowel
y's".
Note: This module capitalizes words like you would expect. Maybe a
couple examples will elucidate this point:
enop('Abc') produces 'Opabc'
enop('abC') produces 'opabC'
Unfortunately, this function, currently converts consecutive spaces
and newlines into single spaces and newlines. Yes, this is not a
is_deeply enop('to'), 'topo',
'single vowel terminating string';
is_deeply enop('bee'), 'bopee',
'double vowel terminating string';
is_deeply enop('ye'), 'yope',
'handle ye';
is_deeply enop('yellow'), 'yopellopow',
'notice a non-vowel starting y';
is_deeply enop('Abc'), 'Opabc',
'preserve ucfirst';
is_deeply enop('eg/test.txt'), 'eg/opish-test.txt',
'convert eg/test.txt to eg/opish-test.txt';
ok -e 'eg/opish-test.txt',
'eg/opish-test.txt was created';
( run in 0.421 second using v1.01-cache-2.11-cpan-05444aca049 )