Acme-Cow

 view release on metacpan or  search on metacpan

Cow.pm  view on Meta::CPAN

package Acme::Cow;

use strict;

$Acme::Cow::VERSION = '0.2.1';

# Preloaded methods go here.

# Autoload methods go after =cut, and are processed by the autosplit program.

# Below is stub documentation for your module. You better edit it!

=head1 NAME

Acme::Cow - Talking barnyard animals (or ASCII art in general)

=head1 SYNOPSIS

  use Acme::Cow;

  $cow = new Acme::Cow;
  $cow->say("Moo!");
  $cow->print();

  $sheep = new Acme::Cow::Sheep;	# Derived from Acme::Cow
  $sheep->wrap(20);
  $sheep->think();
  $sheep->text("Yeah, but you're taking the universe out of context.");
  $sheep->print(\*STDERR);

  $duck = new Acme::Cow(File => "duck.cow");
  $duck->fill(0);
  $duck->say(`figlet quack`);
  $duck->print($socket);


=head1 DESCRIPTION

Acme::Cow is the logical evolution of the old cowsay program.  Cows
are derived from a base class (Acme::Cow) or from external files.

Cows can be made to say or think many things, optionally filling
and justifying their text out to a given margin,

Cows are nothing without the ability to print them, or sling them
as strings, or what not.

=cut

use Acme::Cow::TextBalloon;
use IO::File;
use Text::Template;

$Acme::Cow::default_cow = <<'EOC';
{$balloon}
        {$tl}   ^__^
         {$tl}  ({$el}{$er})\_______
            (__)\       )\/\
             {$U} ||----w |
                ||     ||
EOC

=pod

=head1 METHODS

=head2 new

=over 4

=item Parameters

A list of key-value pairs.  If you plan to use an external file as
the template, you probably want to say:

	$x = new Acme::Cow(File => 'file.cow');

=item Returns

A blessed reference to an C<Acme::Cow>.

=back

=cut

sub new 
{
    my $proto = shift;
    my $class = ref $proto || $proto;
    my %args = @_;
    my $self = {
	wrap => 40,
	mode => 'say',
	fill => 1,
	over => 0,
	text => undef,
	el => 'o',
	er => 'o',
	U => '  ',



( run in 1.386 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )