Image-Placeholder
view release on metacpan or search on metacpan
bin/placeholder view on Meta::CPAN
#!/usr/bin/env perl
use Modern::Perl;
use Getopt::Long;
use Image::Placeholder;
use Pod::Usage;
my %options = get_options_or_exit();
my $size = shift;
my $text = shift;
$options{'size'} = $size
if defined $size;
$options{'text'} = $text
if defined $text;
my $image = Image::Placeholder->new( %options );
print $image->generate();
exit;
sub get_options_or_exit {
my @options = qw(
transparent|a
background-colour|b=s
font|f=s
line-colour|l=s
help|h
output-format|o=s
text-colour|t=s
width|x=i
height|y=i
);
my %mappings = (
'background-colour' => 'background_colour',
'line-colour' => 'line_colour',
'text-colour' => 'text_colour',
);
my %getopts;
my %options;
my $known = GetOptions( \%getopts, @options );
pod2usage()
if !$known or $getopts{'help'};
while ( my( $key, $value ) = each %getopts ) {
my $use_key = $mappings{ $key } // $key;
$options{ $use_key } = $value;
}
return %options;
}
__END__
=head1 NAME
( run in 3.961 seconds using v1.01-cache-2.11-cpan-63c85eba8c4 )