2 # scan_stuff scans papers
3 # and is released under the terms of the GNU GPL version 3, or any
4 # later version, at your option. See the file README and COPYING for
6 # Copyright 2014 by Don Armstrong <don@donarmstrong.com>.
17 scan_stuff - scans papers
24 --debug, -d debugging level (Default 0)
25 --help, -h display this help
26 --man, -m display manual
34 Debug verbosity. (Default 0)
38 Display brief usage information.
55 my %options = (device => 'fujitsu',
65 'debug|d+','help|h|?','man|m');
67 pod2usage() if $options{help};
68 pod2usage({verbose=>2}) if $options{man};
70 $DEBUG = $options{debug};
74 if (exists $options{duplex} and exists $options{simplex} and
75 not ($options{duplex} xor $options{simplex})) {
76 push @USAGE_ERRORS,"Conflicting --duplex and --simplex options given";
79 pod2usage(join("\n",@USAGE_ERRORS)) if @USAGE_ERRORS;
82 if ((exists $options{duplex} and not $options{duplex}) or
83 (exists $options{simplex} and $options{simplex})) {
95 find(sub { return if /^\./;
96 $File::Find::prune = 1 if -d $_;
98 $last_num = $1 if $1 > $last_num;
105 exec('scanimage','-d',$options{device},
106 '--source',$use_duplex?'ADF Duplex':'ADF Front','--mode',$options{mode},'--format','tiff',
107 '--batch=out_'.sprintf('%03d',$last_num).'_%03d.tif');