Changeset fc8707b for client/bin/gbr
- Timestamp:
- Oct 2, 2010, 9:20:02 PM (15 years ago)
- Branches:
- master, debian, mac, no-cups
- Children:
- a5cf43b
- Parents:
- 6b7441a
- git-author:
- Jessica B. Hamrick <jhamrick@…> (10/02/10 21:20:02)
- git-committer:
- Jessica B. Hamrick <jhamrick@…> (10/02/10 21:20:02)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
client/bin/gbr
r6b7441a rfc8707b 12 12 use Image::ExifTool qw(ImageInfo); 13 13 14 my $usage = "Usage: gbr QUEUE FILES\n"; 14 # the usage for this script 15 my $usage = <<USAGE; 16 Usage: gbr [options] [-q QUEUE] FILES 15 17 18 -q, --queue Specify a queue other than the default 19 -d, --dryrun Just list what would be done 20 -h, --help Print this message 21 USAGE 22 23 # initialize the variables for the options 16 24 my $q = ""; 17 GetOptions ('q|queue=s' => \$q); 25 my $dryrun = 0; 26 my $help = 0; 27 28 # parse the options 29 GetOptions ('q|queue=s' => \$q, 30 'd|dryrun' => \$dryrun, 31 'h|help' => \$help); 32 33 # if the -h flag was passed, then print the usage and exit 34 if ($help) { 35 print $usage; 36 exit 0; 37 } 18 38 19 39 my @files = @ARGV[0 .. $#ARGV]; … … 61 81 # if $printer is not defined, then throw an error 62 82 unless( $printer){ 63 print "Cannot access queue $q... do you have network connectivity and permission to view the queue?\n";83 print "Cannot access queue $q... do you have network connectivity and permission to view the queue?\n"; 64 84 exit 1; 65 85 } … … 100 120 } 101 121 102 # send the print job, given the file and the job title 103 $jobid = $printer->printFile($file, $title); 104 105 # if the printFile command returned a job id, then print that out 106 # for the user to see 107 if ($jobid) { 108 print "Sent job '$title' (id $jobid)\n"; 109 } 122 # unless it's a dry run, send the print job, given the file and 123 # the job title 124 unless ($dryrun) { 125 $jobid = $printer->printFile($file, $title); 110 126 111 # otherwise, let them know that an error occurred 112 else { 113 print "Error sending job '$title'\n"; 114 } 127 # if the printFile command returned a job id, then print that out 128 # for the user to see 129 if ($jobid) { 130 print "Sent job '$title' (id $jobid)\n"; 131 } 132 133 # otherwise, let them know that an error occurred 134 else { 135 print "Error sending job '$title'\n"; 136 } 137 138 # otherwise, just print what we would do 139 } else { 140 print "Would send file '$file' with title '$title'\n"; 141 } 115 142 }
Note: See TracChangeset
for help on using the changeset viewer.