1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
|
BEGIN {
$INFILE = $0;
$OUTFILE = $0;
$LEN = 42;
$H = 2;
$W = -10;
$TIMEOUT = 7;
@ARGV = (
'-i', $INFILE,
"-out=$OUTFILE",
'-lgth', $LEN,
'size', "${H}x${W}",
'-v',
'--timeout', $TIMEOUT,
'--with', 's p a c e s',
7,
);
chmod 0644, $0;
}
sub lucky {
my ($num) = @_;
return $num == 7;
}
use Getopt::Euclid;
use Test::More 'no_plan';
sub got_arg {
my ($key, $val) = @_;
is $ARGV{$key}, $val, "Got expected value for $key";
}
is keys %ARGV, 18 => 'Right number of args returned';
got_arg -i => $INFILE;
got_arg -infile => $INFILE;
got_arg -l => $LEN;
got_arg -len => $LEN;
got_arg -length => $LEN;
got_arg -lgth => $LEN;
got_arg -girth => 42;
got_arg -o => $OUTFILE;
got_arg -ofile => $OUTFILE;
got_arg -out => $OUTFILE;
got_arg -outfile => $OUTFILE;
got_arg -v => 1,
got_arg -verbose => 1,
is ref $ARGV{'--timeout'}, 'HASH' => 'Hash reference returned for timeout';
is $ARGV{'--timeout'}{min}, $TIMEOUT => 'Got expected value for timeout <min>';
is $ARGV{'--timeout'}{max}, -1 => 'Got default value for timeout <max>';
is ref $ARGV{size}, 'HASH' => 'Hash reference returned for size';
is $ARGV{size}{h}, $H => 'Got expected value for size <h>';
is $ARGV{size}{w}, $W => 'Got expected value for size <w>';
is $ARGV{'--with'}, 's p a c e s' => 'Handled spaces correctly';
is $ARGV{-w}, 's p a c e s' => 'Handled alternation correctly';
is $ARGV{'<step>'}, 7 => 'Handled step size correctly';
__END__
=head1 NAME
orchestrate - Convert a file to Melkor's .orc format
=head1 VERSION
This documentation refers to orchestrate version 1.9.4
=head1 USAGE
orchestrate -in source.txt --out dest.orc -verbose -len=24
=head1 REQUIRED ARGUMENTS
=over
=item -i[nfile] [=]<file>
Specify input file
=for Euclid:
file.type: readable
file.default: '-'
=item -o[ut][file]= <out_file>
Specify output file
=for Euclid:
out_file.type: writable
out_file.default: '-'
=back
=head1 OPTIONS
=head2 General behaviour
You can customize the usage of orchestrate with the following options:
=over
=item size <h>x<w>
Specify height and width
=item -l[[en][gth]] <l>
Display length [default: 24 ]
=for Euclid:
l.type: int > 0
l.default: 24
=item -girth <g>
Display girth [default: 42 ]
=for Euclid:
g.default: 42
=back
Note however that those flags are optional: since C<orchestrate> comes with
some sane defaults, you can fire C<orchestrate> as is.
=head2 Ratings
You can also take advantage of ratings if you want
=over
=item -v[erbose]
Print all warnings
=item --timeout [<min>] [<max>]
=for Euclid:
min.type: int
max.type: int
max.default: -1
=item -w <space> | --with <space>
Test something spaced
=item <step>
Step size
=for Euclid:
step.type: int, lucky(step)
=item --version
=item --usage
=item --help
=item --man
Print the usual program information
=back
=begin remainder of documentation here...
=end
=head1 AUTHOR
Damian Conway (damian@conway.org)
=head1 BUGS
There are undoubtedly serious bugs lurking somewhere in this code.
Bug reports and other feedback are most welcome.
=head1 COPYRIGHT
Copyright (c) 2002, Damian Conway. All Rights Reserved.
This module is free software. It may be used, redistributed
and/or modified under the terms of the Perl Artistic License
(see http://www.perl.com/perl/misc/Artistic.html)
|