Acme-Cow-Interpreter
view release on metacpan or search on metacpan
bin/cowtidy.pl view on Meta::CPAN
#!/usr/bin/perl
#
# cowtidy - pretty-prints Cow source code
################################################################################
## Modules and package variables.
################################################################################
use strict; # restrict unsafe constructs
use warnings; # control optional warnings
use File::Basename (); # split a pathname into pieces
use Getopt::Std (); # process single-character command line options
# Initialize option variables.
our $opt_n;
our $opt_s;
our $opt_h;
our $opt_v;
################################################################################
## File-private lexical variables.
################################################################################
my $VERSION = '0.002'; # program version
my $PROGNAME = File::Basename::basename($0); # program name
################################################################################
## Subroutines.
################################################################################
################################################################################
# print_version
#
# Print program version and copyright information.
#
sub print_version () {
print <<"EOF" or die "$PROGNAME: print failed: $!\n";
$PROGNAME $VERSION
Copyright 2007-2020 Peter John Acklam.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
EOF
}
################################################################################
# print_usage
#
# Print program usage.
#
sub print_usage () {
print <<"EOF" or die "$PROGNAME: print failed: $!\n";
Usage: $PROGNAME [programfile]
Cow source code pretty-printer.
-n use line numbering
-s separate different instructions by a blank line
-h print usage and exit
-v print version information and exit
If program file is omitted, code is read through the standard input.
Report bugs to <pjacklam\@gmail.com>.
EOF
}
################################################################################
## Process command line options and arguments.
################################################################################
( run in 1.079 second using v1.01-cache-2.11-cpan-99c4e6809bf )