Acme-AliG

 view release on metacpan or  search on metacpan

lib/Acme/AliG.pm  view on Meta::CPAN

    "had a piss" => "did a piss",
    "having a piss" => "doing a piss",
    "slagging off" => "dissing",
    "welcome to" => "hear me now, dis is",
);

sub alig {
    my ($s) = @_;
    while (my ($key, $value) = each %phrases) { $s =~ s/\b$key\b/$value/g }
    while (my ($key, $value) = each %words)   { $s =~ s/\b$key\b/$value/g }
    foreach (split ' ', $s) {
        $s =~ s/ing\b/in/g;
        $s =~ s/th\b/f/g;
        $s =~ s/en\b/un/g;
        $s =~ s/er\b/a/g;
        $s =~ s/or\b/a/g;
        #$s =~ s/^h//;
    }
    if ($s =~ /\?/) {
        $s =~ s/(.*\?)/$1 Is it becoz I is black?/ if int(rand() * 3) == 0;
    } elsif ($s =~ /!/) {
        $s =~ s/(.*)!/$1, boyakasha!/              if int(rand() * 3) == 0;
    }
    return $s;
}

# ABSTRACT: Translates from English to Ali G


1;

__END__

=pod

=head1 NAME

Acme::AliG - Translates from English to Ali G

=head1 VERSION

version 0.0102

=head1 SYNOPSIS

    echo hello | alig

The above command will print 'allo'.

=head1 DESCRIPTION

This module provides a script called alig. It will translate whatever you
feed it via STDIN from English to Ali G.

=head1 AUTHOR

Naveed Massjouni <naveedm9@gmail.com>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Naveed Massjouni.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut



( run in 1.452 second using v1.01-cache-2.11-cpan-bbcb1afb8fc )