275 |
# If fixed some day, use this: '' => sub { push @ARGV, "-" } |
# If fixed some day, use this: '' => sub { push @ARGV, "-" } |
276 |
my $stdin = grep /^-$/, @ARGV; |
my $stdin = grep /^-$/, @ARGV; |
277 |
@ARGV = grep !/^-$/, @ARGV; |
@ARGV = grep !/^-$/, @ARGV; |
278 |
%option = (%option, |
%option = ("h|help" => sub { print $help; exit 0 }, |
|
"h|help" => sub { print $help; exit 0 }, |
|
279 |
"V|version" => sub { print $version; exit 0 }, |
"V|version" => sub { print $version; exit 0 }, |
280 |
|
|
281 |
"v|verbose" => \$verbose, |
"v|verbose" => \$verbose, |
282 |
"d|debug" => \$debug, |
"d|debug" => \$debug, |
283 |
'f|force' => \$force, |
'f|force' => \$force, |
284 |
); |
|
285 |
Getopt::Long::Configure ("bundling"); |
# User options last, so that they have precedence. |
286 |
|
%option); |
287 |
|
Getopt::Long::Configure ("bundling", "pass_through"); |
288 |
GetOptions (%option) |
GetOptions (%option) |
289 |
or exit 1; |
or exit 1; |
290 |
|
|
291 |
|
foreach (grep { /^-./ } @ARGV) |
292 |
|
{ |
293 |
|
print STDERR "$0: unrecognized option `$_'\n"; |
294 |
|
print STDERR "Try `$0 --help' for more information.\n"; |
295 |
|
exit (1); |
296 |
|
} |
297 |
|
|
298 |
push @ARGV, '-' |
push @ARGV, '-' |
299 |
if $stdin; |
if $stdin; |
300 |
} |
} |