Changeset 28106 for trunk/pstamp/scripts/pstamp_webrequest.pl
- Timestamp:
- May 26, 2010, 9:12:02 AM (16 years ago)
- File:
-
- 1 edited
-
trunk/pstamp/scripts/pstamp_webrequest.pl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pstamp/scripts/pstamp_webrequest.pl
r27355 r28106 23 23 24 24 my $host = hostname(); 25 my $verbose = 0;25 my $verbose = 1; 26 26 my $dbname; 27 27 my $dbserver; … … 152 152 exit 0; 153 153 154 # Temporary hack 155 # webrequest number is stored in a file in the current directory 156 # 154 # Ask the database for the next web request number 157 155 sub get_webreq_num 158 156 { 159 my $filename = "webreq_num.txt"; 160 if (! open IN, "+< $filename" ) { 161 my $initial_num = 1; 162 open IN, "> $filename" or die "can't open $filename"; 163 print IN "$initial_num\n" or die "failed to initialize $filename"; 164 close IN; 165 return $initial_num; 157 my $command = "$pstamptool -getwebrequestnum"; 158 $command .= " -dbname $dbname" if $dbname; 159 $command .= " -dbserver $dbserver" if $dbserver; 160 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 161 run(command => $command, verbose => $verbose); 162 unless ($success) { 163 print STDERR @$stderr_buf; 164 die("Unable to perform pstamptool -getwebrequestnum: $error_code"); 165 } 166 my $webreq_num = ${$stdout_buf}[0]; 167 chomp $webreq_num; 168 169 if (!$webreq_num) { 170 die("pstamptool -getwebreqnum returned no value"); 166 171 } 167 172 168 my $webreq_num = <IN>; 169 chomp $webreq_num; 173 # print STDERR "webreq_num $webreq_num\n"; 170 174 171 print STDERR "$webreq_num\n" if $verbose;172 173 my $next = $webreq_num + 1;174 truncate IN, 0;175 seek IN, 0, 0;176 print IN "$next\n";177 178 close IN;179 175 return $webreq_num; 180 176 }
Note:
See TracChangeset
for help on using the changeset viewer.
