debug => 0,
help => 0,
man => 0,
+ mode => 'Gray'
);
GetOptions(\%options,
+ 'duplex!',
+ 'simplex!',
+ 'mode=s',
'debug|d+','help|h|?','man|m');
pod2usage() if $options{help};
$DEBUG = $options{debug};
my @USAGE_ERRORS;
-# if (1) {
-# push @USAGE_ERRORS,"You must pass something";
-# }
+my $use_duplex = 1;
+if (exists $options{duplex} and exists $options{simplex} and
+ not ($options{duplex} xor $options{simplex})) {
+ push @USAGE_ERRORS,"Conflicting --duplex and --simplex options given";
+}
pod2usage(join("\n",@USAGE_ERRORS)) if @USAGE_ERRORS;
+if ((exists $options{duplex} and not $options{duplex}) or
+ (exists $options{simplex} and $options{simplex})) {
+ $use_duplex = 0;
+}
+
+
use File::Find;
if (@ARGV) {
$last_num++;
exec('scanimage','-d',$options{device},
- '--source','ADF Duplex','--mode','Gray','--format','tiff',
- '--batch','out_'.sprintf('%03d',$last_num).'_%03d.tif');
+ '--source',$use_duplex?'ADF Duplex':'ADF Front','--mode',$options{mode},'--format','tiff',
+ '--batch=out_'.sprintf('%03d',$last_num).'_%03d.tif');
__END__