| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | #================================= Job.pm ==================================== | 
| 2 |  |  |  |  |  |  | # Filename:  	       Job.pm | 
| 3 |  |  |  |  |  |  | # Description:         Handle a scanning job, where job is usually a document. | 
| 4 |  |  |  |  |  |  | # Original Author:     Dale M. Amon | 
| 5 |  |  |  |  |  |  | # Revised by:          $Author: amon $ | 
| 6 |  |  |  |  |  |  | # Date:                $Date: 2008-08-28 23:31:44 $ | 
| 7 |  |  |  |  |  |  | # Version:             $Revision: 1.3 $ | 
| 8 |  |  |  |  |  |  | # License:	       LGPL 2.1, Perl Artistic or BSD | 
| 9 |  |  |  |  |  |  | # | 
| 10 |  |  |  |  |  |  | #============================================================================= | 
| 11 | 1 |  |  | 1 |  | 542 | use strict; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 25 |  | 
| 12 | 1 |  |  | 1 |  | 5 | use File::Spec; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 31 |  | 
| 13 | 1 |  |  | 1 |  | 756 | use Fault::DebugPrinter; | 
|  | 1 |  |  |  |  | 352 |  | 
|  | 1 |  |  |  |  | 20 |  | 
| 14 | 1 |  |  | 1 |  | 698 | use Fault::ErrorHandler; | 
|  | 1 |  |  |  |  | 316 |  | 
|  | 1 |  |  |  |  | 27 |  | 
| 15 | 1 |  |  | 1 |  | 938 | use Fault::Logger; | 
|  | 1 |  |  |  |  | 24996 |  | 
|  | 1 |  |  |  |  | 27 |  | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 1 |  |  | 1 |  | 1876 | use Document::Directory; | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | use Document::PageIterator; | 
| 19 |  |  |  |  |  |  | use Document::PageId; | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | use Scanner::Device; | 
| 22 |  |  |  |  |  |  | use Scanner::Format; | 
| 23 |  |  |  |  |  |  | use Scanner::Page; | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | package Scanner::Job; | 
| 26 |  |  |  |  |  |  | use vars qw{@ISA}; | 
| 27 |  |  |  |  |  |  | @ISA = qw( UNIVERSAL ); | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | #============================================================================= | 
| 30 |  |  |  |  |  |  | #                          CLASS METHODS | 
| 31 |  |  |  |  |  |  | #============================================================================= | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | sub new { | 
| 34 |  |  |  |  |  |  | my ($class,$scanner,$firstpage,$format,$Spine_Width_Inches,$Total_Sheets, | 
| 35 |  |  |  |  |  |  | $path,$date,$publication) = @_; | 
| 36 |  |  |  |  |  |  | my $self                      = bless {}, $class; | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | my $pgformat = Scanner::Format->new ('format' => $format); | 
| 39 |  |  |  |  |  |  | if (!defined $pgformat) { | 
| 40 |  |  |  |  |  |  | Fault::ErrorHandler->warn ("Invalid page format"); | 
| 41 |  |  |  |  |  |  | return undef; | 
| 42 |  |  |  |  |  |  | } | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | if ($Total_Sheets <= 0) { | 
| 45 |  |  |  |  |  |  | Fault::ErrorHandler->warn ("Total Sheets cannot be zero!"); | 
| 46 |  |  |  |  |  |  | return undef; | 
| 47 |  |  |  |  |  |  | } | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | if ($Spine_Width_Inches <= 0.0) { | 
| 50 |  |  |  |  |  |  | Fault::ErrorHandler->warn ("Spine Width cannot be 0.0 inches!"); | 
| 51 |  |  |  |  |  |  | return undef; | 
| 52 |  |  |  |  |  |  | } | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | my ($w,$h) = $pgformat->UserDimensions; | 
| 55 |  |  |  |  |  |  | my $so     = $pgformat->orientation; | 
| 56 |  |  |  |  |  |  | my $sw     = ($pgformat->portrait)  ? $Spine_Width_Inches : $w; | 
| 57 |  |  |  |  |  |  | my $sh     = ($pgformat->landscape) ? $Spine_Width_Inches : $h; | 
| 58 |  |  |  |  |  |  | my $spine  = Scanner::Format->new ('format' => "${so}:${sw}x${sh}"); | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | my @parse  = Document::PageId->parse ($firstpage); | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | if ( !($parse[0] and !$parse[1])) { | 
| 63 |  |  |  |  |  |  | Fault::ErrorHandler->warn | 
| 64 |  |  |  |  |  |  | ("First page is not in a recognizable format: \"$firstpage\""); | 
| 65 |  |  |  |  |  |  | return undef; | 
| 66 |  |  |  |  |  |  | } | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | $self->{'scanner'}      = $scanner; | 
| 69 |  |  |  |  |  |  | $self->{'FirstPage'}    = $firstpage; | 
| 70 |  |  |  |  |  |  | $self->{'PageFormat'}   = $pgformat; | 
| 71 |  |  |  |  |  |  | $self->{'SpineFormat'}  = $spine; | 
| 72 |  |  |  |  |  |  | $self->{'Total_Sheets'} = $Total_Sheets; | 
| 73 |  |  |  |  |  |  |  | 
| 74 |  |  |  |  |  |  | $self->{'pgspersheet'} = 1; | 
| 75 |  |  |  |  |  |  | $self->{'batchlen'}	 = 1; | 
| 76 |  |  |  |  |  |  | $self->{'batchcnt'}	 = 0; | 
| 77 |  |  |  |  |  |  | $self->{'PageTitle'}   = "cover"; | 
| 78 |  |  |  |  |  |  | $self->{'FirstPageId'} = ($firstpage == 0) ? | 
| 79 |  |  |  |  |  |  | "000a" : sprintf "%03d",$firstpage; | 
| 80 |  |  |  |  |  |  |  | 
| 81 |  |  |  |  |  |  | $self->{'curpgobj1'} = Document::PageIterator->new ($self->{'FirstPageId'}); | 
| 82 |  |  |  |  |  |  | $self->{'curpgobj2'} = Document::PageIterator->new ($self->{'FirstPageId'}); | 
| 83 |  |  |  |  |  |  | $self->{'document'}  = Document::Directory->open ($path,$date,$publication); | 
| 84 |  |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | return $self; | 
| 86 |  |  |  |  |  |  | } | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | #============================================================================= | 
| 89 |  |  |  |  |  |  | #                          INSTANCE METHODS | 
| 90 |  |  |  |  |  |  | #============================================================================= | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | sub scan ($) { | 
| 93 |  |  |  |  |  |  | my $self = shift; | 
| 94 |  |  |  |  |  |  | my $fs   = $self->{'document'}->filespec; | 
| 95 |  |  |  |  |  |  | my ($pageid, $format, $title); | 
| 96 |  |  |  |  |  |  |  | 
| 97 |  |  |  |  |  |  | if ($self->isSpine) { | 
| 98 |  |  |  |  |  |  | $pageid = "000.spine"; | 
| 99 |  |  |  |  |  |  | $format = $self->{'SpineFormat'}; | 
| 100 |  |  |  |  |  |  | $title  = "spine"; | 
| 101 |  |  |  |  |  |  | } | 
| 102 |  |  |  |  |  |  | else { | 
| 103 |  |  |  |  |  |  | $pageid = $self->pageid; | 
| 104 |  |  |  |  |  |  | $format = $self->{'PageFormat'}; | 
| 105 |  |  |  |  |  |  | $title  = $self->{'PageTitle'}; | 
| 106 |  |  |  |  |  |  | } | 
| 107 |  |  |  |  |  |  |  | 
| 108 |  |  |  |  |  |  | my $curpage = Scanner::Page->new | 
| 109 |  |  |  |  |  |  | ( 'date'   => $fs->dates, | 
| 110 |  |  |  |  |  |  | 'title'  => $fs->undated_filename, | 
| 111 |  |  |  |  |  |  | 'pageid' => $pageid, | 
| 112 |  |  |  |  |  |  | 'format' => $format | 
| 113 |  |  |  |  |  |  | ); | 
| 114 |  |  |  |  |  |  | $self->{'scanner'}->scan ($curpage, $fs->pathname); | 
| 115 |  |  |  |  |  |  |  | 
| 116 |  |  |  |  |  |  | Fault::DebugPrinter->dbg (2, "Scan page " . $pageid); | 
| 117 |  |  |  |  |  |  |  | 
| 118 |  |  |  |  |  |  | $self->{'document'}->add ($pageid,($title) ); | 
| 119 |  |  |  |  |  |  | return $self; | 
| 120 |  |  |  |  |  |  | } | 
| 121 |  |  |  |  |  |  |  | 
| 122 |  |  |  |  |  |  | #----------------------------------------------------------------------------- | 
| 123 |  |  |  |  |  |  |  | 
| 124 |  |  |  |  |  |  | sub nextPageNumbers { | 
| 125 |  |  |  |  |  |  | my $self                   = shift; | 
| 126 |  |  |  |  |  |  | my ($curpgobj1,$curpgobj2) = @$self{'curpgobj1','curpgobj2'}; | 
| 127 |  |  |  |  |  |  |  | 
| 128 |  |  |  |  |  |  | if ($self->{'pgspersheet'} == 1) { | 
| 129 |  |  |  |  |  |  | $curpgobj1->nextid(1); | 
| 130 |  |  |  |  |  |  | } | 
| 131 |  |  |  |  |  |  | else { | 
| 132 |  |  |  |  |  |  | $curpgobj1->setpageid ($curpgobj2->get); | 
| 133 |  |  |  |  |  |  | $curpgobj1->nextid    (1); | 
| 134 |  |  |  |  |  |  | $curpgobj2->setpageid ($curpgobj1->get); | 
| 135 |  |  |  |  |  |  | $curpgobj2->nextid    (1); | 
| 136 |  |  |  |  |  |  | } | 
| 137 |  |  |  |  |  |  | return $self; | 
| 138 |  |  |  |  |  |  | } | 
| 139 |  |  |  |  |  |  |  | 
| 140 |  |  |  |  |  |  | #----------------------------------------------------------------------------- | 
| 141 |  |  |  |  |  |  |  | 
| 142 |  |  |  |  |  |  | sub pageid { | 
| 143 |  |  |  |  |  |  | my ($self)           = shift; | 
| 144 |  |  |  |  |  |  | my ($pgobj1,$pgobj2) = @$self{'curpgobj1','curpgobj2'}; | 
| 145 |  |  |  |  |  |  |  | 
| 146 |  |  |  |  |  |  | my $pg1 = (defined $pgobj1) ? $pgobj1->get : "UNDEF"; | 
| 147 |  |  |  |  |  |  | my $pg2 = (defined $pgobj2) ? $pgobj2->get : "UNDEF"; | 
| 148 |  |  |  |  |  |  | return ($self->{'pgspersheet'} == 1) ? $pg1 : "$pg1-$pg2"; | 
| 149 |  |  |  |  |  |  | } | 
| 150 |  |  |  |  |  |  |  | 
| 151 |  |  |  |  |  |  | #----------------------------------------------------------------------------- | 
| 152 |  |  |  |  |  |  |  | 
| 153 |  |  |  |  |  |  | sub guessPageTitle { | 
| 154 |  |  |  |  |  |  | my ($self)           = shift; | 
| 155 |  |  |  |  |  |  | my ($pgobj1,$pgobj2) = @$self{'curpgobj1','curpgobj2'}; | 
| 156 |  |  |  |  |  |  | my $str; | 
| 157 |  |  |  |  |  |  |  | 
| 158 |  |  |  |  |  |  | if ( $pgobj1->get eq "000.spine") {$str = "spine";} | 
| 159 |  |  |  |  |  |  | else {$str = ($pgobj1->get eq $self->{'FirstPageId'}) ? "cover" : "";} | 
| 160 |  |  |  |  |  |  |  | 
| 161 |  |  |  |  |  |  | $self->{'PageTitle'} = $str; | 
| 162 |  |  |  |  |  |  | return $str; | 
| 163 |  |  |  |  |  |  | } | 
| 164 |  |  |  |  |  |  |  | 
| 165 |  |  |  |  |  |  | #----------------------------------------------------------------------------- | 
| 166 |  |  |  |  |  |  |  | 
| 167 |  |  |  |  |  |  | sub setPagesPerSheet { | 
| 168 |  |  |  |  |  |  | my ($self,$pgs) = (shift,shift); | 
| 169 |  |  |  |  |  |  | if ($pgs < 0 or $pgs > 2) {return undef;} | 
| 170 |  |  |  |  |  |  | $self->{'pgspersheet'} = $pgs; | 
| 171 |  |  |  |  |  |  | if ($pgs == 2) { | 
| 172 |  |  |  |  |  |  | $self->{'curpgobj2'}->setpageid ($self->{'curpgobj1'}->get); | 
| 173 |  |  |  |  |  |  | $self->{'curpgobj2'}->nextid    (1); | 
| 174 |  |  |  |  |  |  | } | 
| 175 |  |  |  |  |  |  | return $self->{'pgspersheet'}; | 
| 176 |  |  |  |  |  |  | } | 
| 177 |  |  |  |  |  |  |  | 
| 178 |  |  |  |  |  |  | #----------------------------------------------------------------------------- | 
| 179 |  |  |  |  |  |  |  | 
| 180 |  |  |  |  |  |  | sub setPagesPerSheetAsIn { | 
| 181 |  |  |  |  |  |  | my ($self,$line) = (shift,shift); | 
| 182 |  |  |  |  |  |  | my ($pgobj1,$pgobj2) = @$self{'curpgobj1','curpgobj2'}; | 
| 183 |  |  |  |  |  |  |  | 
| 184 |  |  |  |  |  |  | my ($one,$two) = split (/-/, $line, 2); | 
| 185 |  |  |  |  |  |  | if (defined $one) { | 
| 186 |  |  |  |  |  |  | $pgobj1->setpageid ($one); | 
| 187 |  |  |  |  |  |  | $self->setPagesPerSheet (1); | 
| 188 |  |  |  |  |  |  | if (defined $two) {$pgobj2->setpageid ($two);} | 
| 189 |  |  |  |  |  |  | else              {$pgobj2->setpageid ($one);} | 
| 190 |  |  |  |  |  |  |  | 
| 191 |  |  |  |  |  |  | $self->{'pgspersheet'} = ($pgobj1->get eq $pgobj2->get) ? 1 : 2; | 
| 192 |  |  |  |  |  |  | } | 
| 193 |  |  |  |  |  |  | return $self->{'pgspersheet'}; | 
| 194 |  |  |  |  |  |  | } | 
| 195 |  |  |  |  |  |  |  | 
| 196 |  |  |  |  |  |  | #----------------------------------------------------------------------------- | 
| 197 |  |  |  |  |  |  |  | 
| 198 |  |  |  |  |  |  | sub setBatchLength { | 
| 199 |  |  |  |  |  |  | my ($self,$n) = (shift,shift); | 
| 200 |  |  |  |  |  |  | $n=1 if ($n == 0); | 
| 201 |  |  |  |  |  |  |  | 
| 202 |  |  |  |  |  |  | $self->{'batchlen'}=$n; | 
| 203 |  |  |  |  |  |  | return $n; | 
| 204 |  |  |  |  |  |  | } | 
| 205 |  |  |  |  |  |  |  | 
| 206 |  |  |  |  |  |  | #----------------------------------------------------------------------------- | 
| 207 |  |  |  |  |  |  |  | 
| 208 |  |  |  |  |  |  | sub info ($) { | 
| 209 |  |  |  |  |  |  | my $self = shift; | 
| 210 |  |  |  |  |  |  |  | 
| 211 |  |  |  |  |  |  | printf "[Job]\n" . | 
| 212 |  |  |  |  |  |  | "First page:                %s\n" . | 
| 213 |  |  |  |  |  |  | "Pages Per Sheet:           %d\n" . | 
| 214 |  |  |  |  |  |  | "Total Sheets:              %d\n" . | 
| 215 |  |  |  |  |  |  | "Batch Length:              %d\n" . | 
| 216 |  |  |  |  |  |  | "Batch Down Counter:        %d\n", | 
| 217 |  |  |  |  |  |  | @$self{'FirstPage', 'pgspersheet', | 
| 218 |  |  |  |  |  |  | 'Total_Sheets', 'batchlen', 'batchcnt'}; | 
| 219 |  |  |  |  |  |  |  | 
| 220 |  |  |  |  |  |  | printf ("\n"); $self->{'scanner'}->info; | 
| 221 |  |  |  |  |  |  | printf ("\n"); $self->{'document'}->info; | 
| 222 |  |  |  |  |  |  | printf ("\n"); $self->{'PageFormat'}->info  ("Page"); | 
| 223 |  |  |  |  |  |  | printf ("\n"); $self->{'SpineFormat'}->info ("Spine"); | 
| 224 |  |  |  |  |  |  | printf ("\n"); | 
| 225 |  |  |  |  |  |  |  | 
| 226 |  |  |  |  |  |  | return $self; | 
| 227 |  |  |  |  |  |  | } | 
| 228 |  |  |  |  |  |  |  | 
| 229 |  |  |  |  |  |  | #----------------------------------------------------------------------------- | 
| 230 |  |  |  |  |  |  |  | 
| 231 |  |  |  |  |  |  | sub isSpine         {my $self = shift; | 
| 232 |  |  |  |  |  |  | return ($self->{'PageTitle'} eq "spine");} | 
| 233 |  |  |  |  |  |  |  | 
| 234 |  |  |  |  |  |  | sub setPageTitle    {my $self = shift; $self->{'PageTitle'} = shift; | 
| 235 |  |  |  |  |  |  | return $self->{'PageTitle'};} | 
| 236 |  |  |  |  |  |  |  | 
| 237 |  |  |  |  |  |  | sub initBatchCnt    {my $self=shift; $self->{'batchcnt'}=$self->{'batchlen'}; | 
| 238 |  |  |  |  |  |  | return $self->{'batchcnt'};} | 
| 239 |  |  |  |  |  |  |  | 
| 240 |  |  |  |  |  |  | sub decBatchCnt     {my $self = shift; | 
| 241 |  |  |  |  |  |  | if (--$self->{'batchcnt'} < 0) {$self->{'batchcnt'}=0;} | 
| 242 |  |  |  |  |  |  | return $self->{'batchcnt'};} | 
| 243 |  |  |  |  |  |  |  | 
| 244 |  |  |  |  |  |  | sub pageTitle       {return shift->{'PageTitle'};} | 
| 245 |  |  |  |  |  |  | sub totalSheets     {return shift->{'Total_Sheets'};} | 
| 246 |  |  |  |  |  |  | sub batchLength     {return shift->{'batchlen'};} | 
| 247 |  |  |  |  |  |  | sub pagesPerSheet   {return shift->{'pgspersheet'};} | 
| 248 |  |  |  |  |  |  |  | 
| 249 |  |  |  |  |  |  | #============================================================================= | 
| 250 |  |  |  |  |  |  | #                          POD DOCUMENTATION | 
| 251 |  |  |  |  |  |  | #============================================================================= | 
| 252 |  |  |  |  |  |  | # You may extract and format the documention section with the 'perldoc' cmd. | 
| 253 |  |  |  |  |  |  |  | 
| 254 |  |  |  |  |  |  | =head1 NAME | 
| 255 |  |  |  |  |  |  |  | 
| 256 |  |  |  |  |  |  | Scanner::Job - Handle a scanning job, where job is usually a document. | 
| 257 |  |  |  |  |  |  |  | 
| 258 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 259 |  |  |  |  |  |  |  | 
| 260 |  |  |  |  |  |  | use Scanner::Job; | 
| 261 |  |  |  |  |  |  | $obj = Scanner::Job->new($scanner,$firstpage,$format,$spine_width_inches,$total_sheets,$path,$date,$publication); | 
| 262 |  |  |  |  |  |  |  | 
| 263 |  |  |  |  |  |  | $obj = $obj->scan; | 
| 264 |  |  |  |  |  |  | $obj = $obj->nextPageNumbers; | 
| 265 |  |  |  |  |  |  | $str = $obj->pageid; | 
| 266 |  |  |  |  |  |  | $str = $obj->guessPageTitle; | 
| 267 |  |  |  |  |  |  | $num = $obj->setPagesPerSheet ($pgs); | 
| 268 |  |  |  |  |  |  | $num = $obj->setPagesPerSheetAsIn ($line); | 
| 269 |  |  |  |  |  |  | $num = $obj->setBatchLength ($num); | 
| 270 |  |  |  |  |  |  | $flg = $obj->isSpine; | 
| 271 |  |  |  |  |  |  | $str = $obj->setPageTitle; | 
| 272 |  |  |  |  |  |  | $num = $obj->initBatchCnt; | 
| 273 |  |  |  |  |  |  | $num = $obj->decBatchCnt; | 
| 274 |  |  |  |  |  |  | $str = $obj->pageTitle; | 
| 275 |  |  |  |  |  |  | $num = $obj->totalSheets; | 
| 276 |  |  |  |  |  |  | $num = $obj->batchLength; | 
| 277 |  |  |  |  |  |  | $num = $obj->pagesPerSheet; | 
| 278 |  |  |  |  |  |  |  | 
| 279 |  |  |  |  |  |  | =head1 Inheritance | 
| 280 |  |  |  |  |  |  |  | 
| 281 |  |  |  |  |  |  | UNIVERSAL | 
| 282 |  |  |  |  |  |  |  | 
| 283 |  |  |  |  |  |  | =head1 Description | 
| 284 |  |  |  |  |  |  |  | 
| 285 |  |  |  |  |  |  | Handle a scanning job, where job is usually a document. | 
| 286 |  |  |  |  |  |  |  | 
| 287 |  |  |  |  |  |  | =head1 Examples | 
| 288 |  |  |  |  |  |  |  | 
| 289 |  |  |  |  |  |  | None. | 
| 290 |  |  |  |  |  |  |  | 
| 291 |  |  |  |  |  |  | =head1 Class Variables | 
| 292 |  |  |  |  |  |  |  | 
| 293 |  |  |  |  |  |  | None. | 
| 294 |  |  |  |  |  |  |  | 
| 295 |  |  |  |  |  |  | =head1 Instance Variables | 
| 296 |  |  |  |  |  |  |  | 
| 297 |  |  |  |  |  |  | FirstPage          String identifying the number portion of the first | 
| 298 |  |  |  |  |  |  | page scanned. eg "000" | 
| 299 |  |  |  |  |  |  | FirstPageId        String identifying the the first page scanned, including | 
| 300 |  |  |  |  |  |  | subpage numbers and such. eg "000a" | 
| 301 |  |  |  |  |  |  | FormatPage         Scanner::Format object for pages | 
| 302 |  |  |  |  |  |  | SpineFormat        Scanner::Format object for spine. | 
| 303 |  |  |  |  |  |  | scanner            Scanner object. | 
| 304 |  |  |  |  |  |  | Total_Sheets       Total sheets in document. Not really used yet. | 
| 305 |  |  |  |  |  |  | pgspersheet        Pages per scanned sheet. Usually 1 or 2. | 
| 306 |  |  |  |  |  |  | batchlen	     Number of pages in ADF scan batch. | 
| 307 |  |  |  |  |  |  | batchcnt	     Page count of ADF scan batch. | 
| 308 |  |  |  |  |  |  | PageTitle          Type of page. cover, backcover, contents... | 
| 309 |  |  |  |  |  |  | curpgobj1	     Document::PageIterator for the page, or of the left | 
| 310 |  |  |  |  |  |  | hand page if there are two. | 
| 311 |  |  |  |  |  |  | curpgobj2	     Document::PageIterator for the page, or of the right | 
| 312 |  |  |  |  |  |  | hand page if there are two. | 
| 313 |  |  |  |  |  |  |  | 
| 314 |  |  |  |  |  |  | =head1 Class Methods | 
| 315 |  |  |  |  |  |  |  | 
| 316 |  |  |  |  |  |  | =over 4 | 
| 317 |  |  |  |  |  |  |  | 
| 318 |  |  |  |  |  |  | =item B<$obj = Scanner::Job-Enew ($scanner,$firstpage,$format,$spine_width_inches,$total_sheets,$path,$date,$publication)> | 
| 319 |  |  |  |  |  |  |  | 
| 320 |  |  |  |  |  |  | Create and initialize instances of Scanner::Job. | 
| 321 |  |  |  |  |  |  |  | 
| 322 |  |  |  |  |  |  | scanner              A Scanner object. | 
| 323 |  |  |  |  |  |  | firstpage            Page number to begin scanning at. | 
| 324 |  |  |  |  |  |  | format               A page format string, ie "L:10x12" | 
| 325 |  |  |  |  |  |  | spine_width_inches   Width of the document spine. | 
| 326 |  |  |  |  |  |  | total_sheets         Total sheets in the document. Not really used yet. | 
| 327 |  |  |  |  |  |  | path                 Where to put the document. | 
| 328 |  |  |  |  |  |  | date                 Date of the document. | 
| 329 |  |  |  |  |  |  | publication          Name of the publication, title and author of book or | 
| 330 |  |  |  |  |  |  | paper, etc. | 
| 331 |  |  |  |  |  |  |  | 
| 332 |  |  |  |  |  |  | =head1 Instance Methods | 
| 333 |  |  |  |  |  |  |  | 
| 334 |  |  |  |  |  |  | =over 4 | 
| 335 |  |  |  |  |  |  |  | 
| 336 |  |  |  |  |  |  | =item B<$obj = $obj-Escan> | 
| 337 |  |  |  |  |  |  |  | 
| 338 |  |  |  |  |  |  | Set up the information for the next page of the document and scan it. The | 
| 339 |  |  |  |  |  |  | page will be named, placed in its document directory and logged and added | 
| 340 |  |  |  |  |  |  | to the table of contents file there. | 
| 341 |  |  |  |  |  |  |  | 
| 342 |  |  |  |  |  |  | If the page name is the special token 'spine', then the special pageid of | 
| 343 |  |  |  |  |  |  | "000.spine" is used instead of the current pageid and the document scan | 
| 344 |  |  |  |  |  |  | format is set for the width of the spine in whichever dimension on the | 
| 345 |  |  |  |  |  |  | scanbed is appropriate: scanner height if landscape; scanner width if | 
| 346 |  |  |  |  |  |  | portrait. | 
| 347 |  |  |  |  |  |  |  | 
| 348 |  |  |  |  |  |  | Returns self. | 
| 349 |  |  |  |  |  |  |  | 
| 350 |  |  |  |  |  |  | =item B<$num = $obj-EnextPageNumbers> | 
| 351 |  |  |  |  |  |  |  | 
| 352 |  |  |  |  |  |  | Increment the page number or numbers. | 
| 353 |  |  |  |  |  |  |  | 
| 354 |  |  |  |  |  |  | Returns self. | 
| 355 |  |  |  |  |  |  |  | 
| 356 |  |  |  |  |  |  | =item B<$str = $obj-Epageid> | 
| 357 |  |  |  |  |  |  |  | 
| 358 |  |  |  |  |  |  | Return a pageid string made up from info from one or two pageid objects. | 
| 359 |  |  |  |  |  |  | Returns  or - | 
| 360 |  |  |  |  |  |  |  | 
| 361 |  |  |  |  |  |  | =item B<$str = $obj-EguessPageTitle> | 
| 362 |  |  |  |  |  |  |  | 
| 363 |  |  |  |  |  |  | Make our best guess at what the user is going to want for the title. | 
| 364 |  |  |  |  |  |  | Returns PageTitle. | 
| 365 |  |  |  |  |  |  |  | 
| 366 |  |  |  |  |  |  | =item B<$num = $obj-EsetPagesPerSheet ($pgs)> | 
| 367 |  |  |  |  |  |  |  | 
| 368 |  |  |  |  |  |  | Set the number of pages per sheet and return the value when done. | 
| 369 |  |  |  |  |  |  |  | 
| 370 |  |  |  |  |  |  | =item B<$num = $obj-EsetPagesPerSheetAsIn ($line)> | 
| 371 |  |  |  |  |  |  |  | 
| 372 |  |  |  |  |  |  | Set the pages per sheet to match $line and return the result of doing so. | 
| 373 |  |  |  |  |  |  |  | 
| 374 |  |  |  |  |  |  | =item B<$num = $obj-EsetBatchLength ($n)> | 
| 375 |  |  |  |  |  |  |  | 
| 376 |  |  |  |  |  |  | Set the batch length and return the result of doing so. | 
| 377 |  |  |  |  |  |  |  | 
| 378 |  |  |  |  |  |  | =item B<$flg = $obj-EisSpine> | 
| 379 |  |  |  |  |  |  |  | 
| 380 |  |  |  |  |  |  | Return true if the page is the document spine, ie the page number is 000.spine. | 
| 381 |  |  |  |  |  |  |  | 
| 382 |  |  |  |  |  |  | =item B<$str = $obj-EsetPageTitle> | 
| 383 |  |  |  |  |  |  |  | 
| 384 |  |  |  |  |  |  | Set the page title and return the result of doing so. | 
| 385 |  |  |  |  |  |  |  | 
| 386 |  |  |  |  |  |  | =item B<$num = $obj-EinitBatchCnt> | 
| 387 |  |  |  |  |  |  |  | 
| 388 |  |  |  |  |  |  | Set the batch count to the batch length and return the result. | 
| 389 |  |  |  |  |  |  |  | 
| 390 |  |  |  |  |  |  | =item B<$num = $obj-EdecBatchCnt> | 
| 391 |  |  |  |  |  |  |  | 
| 392 |  |  |  |  |  |  | Decrement the batch count until it reaches 0. Returns the value | 
| 393 |  |  |  |  |  |  | after the decrement. | 
| 394 |  |  |  |  |  |  |  | 
| 395 |  |  |  |  |  |  | =item B<$str = $obj-EpageTitle> | 
| 396 |  |  |  |  |  |  |  | 
| 397 |  |  |  |  |  |  | Returns the page title. | 
| 398 |  |  |  |  |  |  |  | 
| 399 |  |  |  |  |  |  | =item B<$num = $obj-EtotalSheets> | 
| 400 |  |  |  |  |  |  |  | 
| 401 |  |  |  |  |  |  | Returns the total sheets. | 
| 402 |  |  |  |  |  |  |  | 
| 403 |  |  |  |  |  |  | =item B<$num = $obj-EbatchLength> | 
| 404 |  |  |  |  |  |  |  | 
| 405 |  |  |  |  |  |  | Returns the batch length. | 
| 406 |  |  |  |  |  |  |  | 
| 407 |  |  |  |  |  |  | =item B<$num = $obj-EpagesPerSheet> | 
| 408 |  |  |  |  |  |  |  | 
| 409 |  |  |  |  |  |  | Returns the pages per sheet. | 
| 410 |  |  |  |  |  |  |  | 
| 411 |  |  |  |  |  |  | =back 4 | 
| 412 |  |  |  |  |  |  |  | 
| 413 |  |  |  |  |  |  | =head1 Private Class Method | 
| 414 |  |  |  |  |  |  |  | 
| 415 |  |  |  |  |  |  | None. | 
| 416 |  |  |  |  |  |  |  | 
| 417 |  |  |  |  |  |  | =head1 Private Instance Methods | 
| 418 |  |  |  |  |  |  |  | 
| 419 |  |  |  |  |  |  | None. | 
| 420 |  |  |  |  |  |  |  | 
| 421 |  |  |  |  |  |  | =head1 Errors and Warnings | 
| 422 |  |  |  |  |  |  |  | 
| 423 |  |  |  |  |  |  | None. | 
| 424 |  |  |  |  |  |  |  | 
| 425 |  |  |  |  |  |  | =head1 KNOWN BUGS | 
| 426 |  |  |  |  |  |  |  | 
| 427 |  |  |  |  |  |  | See TODO. | 
| 428 |  |  |  |  |  |  |  | 
| 429 |  |  |  |  |  |  | =head1 SEE ALSO | 
| 430 |  |  |  |  |  |  |  | 
| 431 |  |  |  |  |  |  | Document::LogFile, Document::TocFile, Document::Toc, Document::PageIterator, | 
| 432 |  |  |  |  |  |  | Scanner, Scanner::Page | 
| 433 |  |  |  |  |  |  |  | 
| 434 |  |  |  |  |  |  | =head1 AUTHOR | 
| 435 |  |  |  |  |  |  |  | 
| 436 |  |  |  |  |  |  | Dale Amon | 
| 437 |  |  |  |  |  |  |  | 
| 438 |  |  |  |  |  |  | =cut | 
| 439 |  |  |  |  |  |  |  | 
| 440 |  |  |  |  |  |  | #============================================================================= | 
| 441 |  |  |  |  |  |  | #                                CVS HISTORY | 
| 442 |  |  |  |  |  |  | #============================================================================= | 
| 443 |  |  |  |  |  |  | # $Log: Job.pm,v $ | 
| 444 |  |  |  |  |  |  | # Revision 1.3  2008-08-28 23:31:44  amon | 
| 445 |  |  |  |  |  |  | # Major rewrite. Shuffled code between classes and add lots of features. | 
| 446 |  |  |  |  |  |  | # | 
| 447 |  |  |  |  |  |  | # Revision 1.2  2008-08-07 19:52:48  amon | 
| 448 |  |  |  |  |  |  | # Upgrade source format to current standard. | 
| 449 |  |  |  |  |  |  | # | 
| 450 |  |  |  |  |  |  | # Revision 1.1.1.1  2008-08-06 21:36:11  amon | 
| 451 |  |  |  |  |  |  | # Classes for scanner use abstractions. | 
| 452 |  |  |  |  |  |  | # | 
| 453 |  |  |  |  |  |  | # 20070511   Dale Amon | 
| 454 |  |  |  |  |  |  | #	     Created. | 
| 455 |  |  |  |  |  |  | 1; |