#!/usr/local/bin/perl -W # (X)Emacs mode: -*- cperl -*- =head1 DESCRIPTION No description =head1 EXAMPLES Z<> =head1 BUGS Z<> =head1 REPORTING BUGS Log them in gnats. =head1 AUTHOR Martyn J. Pearce C =head1 SEE ALSO Z<> =cut # Pragmas ----------------------------- require 5.005_62; use strict; # Utility ----------------------------- use Fatal 1.02 qw( :void close open seek sysopen ); use Fcntl 1.03 qw( :DEFAULT ); use Log::Info 1.09 qw( :DEFAULT :default_channels :log_levels ); # Package Master use Getopt::Plus qw( :opt_types :exit_codes $PACKAGE ); # Fix version to make testing easier BEGIN { our $VERSION = '0.01'; } # Constants --------------------------- my ($fail, $fail2, $fail3, $msg); my $RSE = Getopt::Plus->new(scriptname => 'test-script-3', scriptsumm => 'Test Getopt-Plus functionality', check => sub { # print STDERR "check\n"; die "Message\n" if $msg; # Deliberately leave this to test # that 0 return *doesn't* cause failure return $fail3 ? 0 : 1; }, output_suffix => [ 'foo', 'bar' ], initialize => sub { # print STDERR "initialize\n"; $_[0]->die(ERR_USAGE, "Squeek\n") if defined $fail; $_[0]->die(ERR_UNKNOWN, "Squawk\n") if defined $fail2; }, finalize => sub { # print STDERR "finalize\n"; }, end => sub { # print STDERR "end\n"; }, main => sub { # print STDERR "main\n"; my $rse = shift; my ($in, $outs) = @_; print "IN: $in\n"; print "OUT: $_\n" for sort @$outs; }, arg_ary => '*', argtype => 'file', copyright => 'Copyright __CYEARS__ Martyn J. Pearce', c_years => [ 2002 ], options => [{ names => [qw/ fail1 /], type => OPT_BOOLEAN, linkage => \$fail, }, { names => [qw/ fail2 /], type => OPT_BOOLEAN, linkage => \$fail2, }, { names => [qw/ fail3 /], type => OPT_BOOLEAN, linkage => \$fail3, summary => "doesn't actually fail", }, { names => [qw/ msg /], type => OPT_BOOLEAN, linkage => \$msg, }, ], ); # Subrs ---------------------------------------------------------------------- sub initialize { my $rse = shift; } # Main ----------------------------------------------------------------------- $RSE->run; __END__