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',
66 'debug|d+','help|h|?','man|m');
68 pod2usage() if $options{help};
69 pod2usage({verbose=>2}) if $options{man};
71 $DEBUG = $options{debug};
75 if (exists $options{duplex} and exists $options{simplex} and
76 not ($options{duplex} xor $options{simplex})) {
77 push @USAGE_ERRORS,"Conflicting --duplex and --simplex options given";
80 pod2usage(join("\n",@USAGE_ERRORS)) if @USAGE_ERRORS;
83 if ((exists $options{duplex} and not $options{duplex}) or
84 (exists $options{simplex} and $options{simplex})) {
96 find(sub { return if /^\./;
97 $File::Find::prune = 1 if -d $_;
99 $last_num = $1 if $1 > $last_num;
106 exec('scanimage','-d',$options{device},
107 '--source',$use_duplex?'ADF Duplex':'ADF Front','--mode',$options{mode},'--format','tiff',
108 '--batch=out_'.sprintf('%03d',$last_num).'_%03d.tif');