Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add just enough option handling and documentation to handle --help|-h…
…|-? and --man
  • Loading branch information
Geoffrey Broadwell committed Jun 10, 2012
1 parent 0f6bc6f commit f3a1716
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions bench
Expand Up @@ -5,6 +5,8 @@
use 5.010;
use strict;
use warnings;
use Pod::Usage;
use Getopt::Long;
use Time::HiRes 'time';
use File::Temp 'tempfile';
use List::Util 'min', 'max';
Expand Down Expand Up @@ -185,6 +187,12 @@ my %TESTS = (
MAIN();

sub MAIN {
my %opt;
GetOptions(\%opt, 'help|h|?!', 'man!')
or pod2usage(-verbose => 0);
pod2usage(-verbose => 1) if $opt{help};
pod2usage(-verbose => 2) if $opt{man};

my @results;

eval {
Expand Down Expand Up @@ -407,3 +415,52 @@ sub center {

return $output;
}


__END__

=head1 NAME
bench -- Benchmark Perl-family compilers against each other
=head1 SYNOPSIS
bench [--help|-h|-?] [--man]
=head1 DESCRIPTION
This program benchmarks a number of implementations of Perl-family languages
against each other doing various simple tasks. For a given task, each
language uses a similar algorithm, but written in the appropriate colloquial
style. For a given language, all relevant implementations execute exactly
the same program for each task, or are marked as unable to process that task.
The simplest tasks are executed using each implementation's "evaluate a string
from the command line" option, generally C<-e> or C<-E>. More complex tasks
are composed of matching scripts sorted into subdirectories by language,
optionally with additional command line arguments.
=head1 OPTIONS
=over 4
=item --help|-h|-?
Get basic help for this program
=item --man
Display this program's entire manpage
=back
=head1 AUTHOR
Geoffrey Broadwell
=cut

0 comments on commit f3a1716

Please sign in to comment.