Source

p5-acme-pony-pink / bin / perl-pink-pony

Full commit
#!perl

use Acme::Pony::Pink;
use Getopt::Long;
use Pod::Usage;

GetOptions(
	'help|usage|h' => sub { pod2usage(1) },
	'man'          => sub { pod2usage(-exitstatus => 0, -verbose => 2) },
) or pod2usage(2);

my ($infile, $outfile) = @ARGV;

if (not defined $infile or $infile eq '-')
{
	$infile = \*STDIN;
}

if (not defined $outfile and not ref $infile)
{
	$outfile = $infile . '.gif';
	$outfile =~ s/\.pl\.gif$/.gif/;
}
elsif (not defined $outfile or $outfile eq '-')
{
	$outfile = \*STDOUT;
}

my $acme = Acme::Pony::Pink->new;
$acme->ponify($infile => $outfile);

__END__

=head1 NAME

perl-pink-pony - convert your script into a pink pony

=head1 SYNOPSIS

 perl-pink-pony infile.pl outfile.gif
 
 Options:
   --help        brief help message
   --man         full documentation

=head1 OPTIONS

=over 4

=item B<--help>

Print a brief help message and exits.

=item B<--man>

Prints the manual page and exits.

=back

=head1 DESCRIPTION

This program will read the given input file and output a GIF image of a
pink pony.

The input file may be a hyphen to indicate input from STDIN. The output
file may be a hyphen to indicate output to STDOUT. If the input is from
a file and the output file is omitted, the script will invent a filename
for output by replacing the input script's ".pl" file extension with
".gif".

=head1 BUGS

Please report any bugs to someone who cares.

=head1 SEE ALSO

L<Acme::Pony::Pink>.

=head1 AUTHOR

Toby Inkster E<lt>tobyink@cpan.orgE<gt>.

=head1 COPYRIGHT AND LICENCE

This software is copyright (c) 2012 by Toby Inkster.

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

=head1 DISCLAIMER OF WARRANTIES

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

=cut