Acme-Cow
view release on metacpan or search on metacpan
Cow/DragonAndCow.pm view on Meta::CPAN
\ \__/ `/\ / ~-. _ .-~ /
\____({$el}{$er}) *. \} \{ /
( (--) .----~-.\ \-` .~
//__\\ \__ Ack! ///.----..< \ _ -~
// \\ ///-._ _ _ _ _ _ _\{^ - - - - ~
EOC
sub new
{
my $proto = shift;
my $class = ref $proto || $proto;
my $self = $class->SUPER::new();
return bless $self, $class;
}
sub as_string
{
my $self = shift;
return $self->SUPER::as_string($dragon_and_cow);
}
Cow/Example.pm view on Meta::CPAN
/ Insert cute ASCII \
\ artwork here. /
-------------------
{$U}
EOC
sub new
{
my $proto = shift;
my $class = ref $proto || $proto;
my $self = $class->SUPER::new();
$self->over(24);
return $self;
}
sub as_string
{
my $self = shift;
return $self->SUPER::as_string($generic_ascii_art);
}
1;
__END__
=pod
=head1 NAME
Acme::Cow::Example - How to write a "derived cow"
Cow/Example.pm view on Meta::CPAN
you store this template in a variable in your package's namespace.
B<Your template should not have tab characters in it.> This will
cause ugly things to happen.
Your C<new> method will likely want to look a lot like this:
sub new
{
my $proto = shift;
my $class = ref $proto || $proto;
my $self = $class->SUPER::new();
return $self;
}
Assuming you stored the template as C<$my_cow> then
your C<as_string> method will likely want to be like this:
sub as_string
{
my $self = shift;
return $self->SUPER::as_string($my_cow);
}
Below, we present the actual code in this module, so you can see
it in action. Yes, you can use this module to produce ASCII art.
No, it won't be very exciting.
=head1 Acme::Cow::Example code
package Acme::Cow::Example;
Cow/Example.pm view on Meta::CPAN
/ Insert cute ASCII \
\ artwork here. /
-------------------
{$U}
EOC
sub new
{
my $proto = shift;
my $class = ref $proto || $proto;
my $self = $class->SUPER::new();
$self->over(24);
return $self;
}
sub as_string
{
my $self = shift;
return $self->SUPER::as_string($generic_ascii_art);
}
=head1 HIGHLIGHTS
The C<{$balloon}> directive is flush left, but due to the call to
C<over()> in the C<new()> method, it will be shoved over 24 spaces
to the right, to line up with the thought/speech lines (represented
by C<{$tr}>).
=head1 SAVING WORK
Cow/Frogs.pm view on Meta::CPAN
/__ _\ /_ __\
\ \( | ()~() | )/ /
\__|\ | (-___-) | /|__/
' '--' ==`-'== '--' '
EOC
sub new
{
my $proto = shift;
my $class = ref $proto || $proto;
my $self = $class->SUPER::new();
$self->over(46);
return bless $self, $class;
}
sub as_string
{
my $self = shift;
return $self->SUPER::as_string($frogs);
}
1;
Cow/MechAndCow.pm view on Meta::CPAN
({$el}{$er})\_______ /' / | |
(__)\ )\/\ /' / | `i
{$U} ||----w | ___,;`----'.___L_,-'`\__
|| || i_____;----\.____i""\____\
EOC
sub new
{
my $proto = shift;
my $class = ref $proto || $proto;
my $self = $class->SUPER::new();
$self->over(10);
return bless $self, $class;
}
sub as_string
{
my $self = shift;
return $self->SUPER::as_string($mech_and_cow);
}
1;
Cow/Stegosaurus.pm view on Meta::CPAN
`-. | / | / `. ,~~|
~-.__| /_ - ~ ^| /- _ `..-'
| / | / ~-. `-. _ _ _
|_____| |_____| ~ - . _ _ _ _ _>
EOC
sub new
{
my $proto = shift;
my $class = ref $proto || $proto;
my $self = $class->SUPER::new();
$self->over(20);
return bless $self, $class;
}
sub as_string
{
my $self = shift;
return $self->SUPER::as_string($stegosaurus);
}
1;
Cow/TuxStab.pm view on Meta::CPAN
\ /
______( (_ / \______
,' ,-----' | \
`--\{__________) \/
EOC
sub new
{
my $proto = shift;
my $class = ref $proto || $proto;
my $self = $class->SUPER::new();
$self->over(8);
return bless $self, $class;
}
sub as_string
{
my $self = shift;
return $self->SUPER::as_string($tux_being_stabbed);
}
1;
my ${$name} = <<'EOC';
Insert cute ASCII art here
EOC
sub new
\{
my $proto = shift;
my $class = ref $proto || $proto;
my $self = $class->SUPER::new();
return bless $self, $class;
\}
sub as_string
\{
my $self = shifT;
return $self->SUPER::as_string(${$name});
\}
1;
EOF
my $template = new Text::Template(TYPE => 'STRING', SOURCE => $pkg_tmpl);
$private::name = lc($ARGV[0]);
$private::NAME = ucfirst($ARGV[0]);
print $template->fill_in(PACKAGE => 'private');
__END__
( run in 1.219 second using v1.01-cache-2.11-cpan-49f99fa48dc )