File Coverage

blib/lib/Lingua/Bork.pm
Criterion Covered Total %
statement 9 22 40.9
branch 0 8 0.0
condition 0 3 0.0
subroutine 3 5 60.0
pod 0 2 0.0
total 12 40 30.0


line stmt bran cond sub pod time code
1             package Lingua::Bork;
2              
3 1     1   64241 use strict;
  1         3  
  1         38  
4 1     1   6 use warnings;
  1         3  
  1         44  
5              
6             require Exporter;
7              
8 1     1   5 use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $VERSION);
  1         14  
  1         546  
9              
10             @ISA = qw(Exporter);
11              
12             %EXPORT_TAGS = ( 'all' => [ 'bork' ] );
13             @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
14              
15             $VERSION = '0.03';
16              
17             my %map = ( tion => 'shun', # tail only
18             the => 'zee', # full match
19             an => 'un',
20             au => 'oo',
21             en => 'ee', # tail only
22             ir => 'ur',
23             ow => 'oo',
24             # E => 'I', # head only
25             e => 'ea', # tail only
26             f => 'ff',
27             # i => 'ee', # first in word
28             o => 'u', # within word
29             u => 'oo',
30             v => 'f',
31             w => 'v',
32             );
33              
34             sub new {
35 0     0 0   my $class = shift;
36 0   0       bless {}, ref($class)||$class;
37             }
38              
39             sub bork {
40 0     0 0   local $_ = shift;
41 0 0         local $_ = shift if ref($_);
42            
43 0 0         s/(tion\b|\bthe\b|an|au|en\b|ir|ow|e\b|f|\Bo\B|u|v|w)/my $trans = $map{lc $1}; $1 eq lc($1) ? $map{lc $1} : ucfirst($map{lc $1})/eig;
  0            
  0            
44              
45             # first i in a word
46 0 0         s/(i)(\S+)/ $1 eq 'i' ? "ee$2" : "Ee$2" /eig;
  0            
47              
48             # leading e
49 0 0         s/\b(e)(?!e)/ $1 eq 'e' ? 'i' : 'I' /eig;
  0            
50              
51 0           s/([.!?])+/$1 Bork Bork Bork!/g;
52 0           return $_;
53             }
54              
55             1;
56             __END__