Acme-Cow

 view release on metacpan or  search on metacpan

Cow.pm  view on Meta::CPAN

{
    my $self = shift;
    my $b = new Acme::Cow::TextBalloon;
    for my $i (qw(fill text over mode wrap)) {
	$b->{$i} = $self->{$i};
    }
    return $b;
}

sub _slurp_file
{
    my $filename = shift;
    my $fh = new IO::File($filename);
    local $/ = undef;
    my $text = $fh->getline();
    return $text;
}

1;
__END__

=pod

=head1 WRITING YOUR OWN COW FILES

First, get comfortable with C<Text::Template> and its capabilities.

{$balloon} is the text balloon; it should be on a line by itself,
flush-left.  {$tl} and {$tr} are what goes to the text balloon from
the thinking/speaking part of the picture; {$tl} is a backslash
("\") for speech, while {$tr} is a slash ("/"); both are a lowercase
letter O ("o") for thought.  {$el} is a left eye, and {$er} is a
right eye; both are "o" by default.  Finally {$U} is a tongue,
because a capital U looks like a tongue.  (Its default value is "U ".) 
Escape all other curly-braces within the ASCII art with backslashes.

There are two methods to make your own cow file: the standalone
file and the Perl module.

For the standalone file, take your piece of ASCII art and modify
it according to the C<Text::Template> rules above.  Note that the
balloon must be flush-left in the template if you choose this method.
If the balloon isn't meant to be flush-left in the final output,
use its C<over()> method.

For a Perl module, you should C<use Text::Template;> and declare
that your module C<ISA> subclass of C<Acme::Cow>.  You may do other
modifications to the variables in the template, if you wish.  You
will most likely need to write appropriate C<new()> and C<as_string()>
methods; many examples are provided with the C<Acme::Cow> distribution.

Put your module somewhere in your C<@INC> path under the C<Acme::Cow::>
tree, and use it like a normal C<Acme::Cow>.  Remember that you
only inherit methods, not data; any data you want to pull out of
C<Acme::Cow> should be accessed explicitly.  Other than that, make
the methods work as expected and you should have a fully functional
cow.

=head1 HISTORY

They're called "cows" because the original piece of ASCII art was
a cow.  Since then, many have been contributed (i.e. the author
has stolen some) but they're still all cows.

=head1 AUTHOR

Tony Monroe E<lt>tmonroe plus perl at nog dot netE<gt>

=head1 SEE ALSO

L<perl>, L<cowsay>, L<figlet>, L<fortune>, L<cowpm>

=cut



( run in 0.631 second using v1.01-cache-2.11-cpan-99c4e6809bf )