1 package LolCatalyst::Lite::Translator;
4 use namespace::clean -except => 'meta';
6 has 'default_target' => (
7 is => 'ro', isa => 'Str', required => 1, default => 'LOLCAT'
10 has 'translators' => (
11 is => 'ro', isa => 'HashRef', lazy_build => 1
14 sub _build_translators {
16 return { LOLCAT => LolCatalyst::Lite::Translator::LOLCAT->new };
20 my ($self, $text) = @_;
21 $self->translate_to($self->default_target, $text);
25 my ($self, $target, $text) = @_;
26 $self->translators->{$target}->translate($text);
29 __PACKAGE__->meta->make_immutable;
31 package LolCatalyst::Lite::Translator::LOLCAT;
35 use namespace::clean -except => 'meta';
38 my ($self, $text) = @_;
39 return Acme::LOLCAT::translate($text);
42 __PACKAGE__->meta->make_immutable;