[ List Archives Home ] [ Thread index for 2008 ]
[ Date index for 2008 ]
[ Author index for 2008 ]
[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
- Date: Tue, 27 Apr 2004 11:52:17 -0500
- From: "Zhou, Don" <dzhou@xxxxxxxxxx>
- Subject: RE: Conditionals in expect script for create lists
Phil:
I wrote a url checker at our site. The way I look for empty review list
is like this. :
$Size = 9999; ### find a review file size which is bigger than 9999,
$lineNumber = "";
$lastFilenumber = 20; ##20 review lists at a time
until($fileFound) {
( $before, $after ) = $telnet->waitfor( '/' . $lastFile . ' > .*
\d{4,}/' );
$info = $before . $after;
# loop through the first 20 review list to get the last
empty
while ( $info =~ /(\d{2}) > Empty.*?(\d{4,})/) {
if ( $2 >= $fileSize ) { #I want a list more
than 9999
$lineNumber = $1;
$fileFound ++;
}
}
$telnet->print("F");##if no empty in the first 20 files,
go on.
$lastFilenumber+=20;
}
After this is done, I have a review file line number to start searching
for all files with urls in them.
Also, my co presenter Stephen Wynn has an example perl code to look for
empty or even existing files. Look for J3 presensation codes.
Hope this helps.
Don Zhou
William Mitchell College of Law
-----Original Message-----
From: innopac-bounces@xxxxxxxxxx
[
mailto:innopac-bounces@xxxxxxxxxx] On Behalf Of Phil Shirley
Sent: Monday, April 26, 2004 3:37 PM
To: INNOPAC@xxxxxxxxxx
Subject: Conditionals in expect script for create lists
I've been using Expect scripts and Perl scripts to generate title lists
for my web site (and for other purposes) thanks to the kind folks at
NOBLE
who put up the howto on their Swapshop. This works great except for (1)
when I can't predict whether the review file will be empty or not when I
start, and (2) when I can't be sure that the query will produce a
non-zero
number of records. Could somebody send me an example of how you handle
things like this?
More details: I have a report to find problems, which I would like to
run
every night with no intervention necessary (using cron); often it will
find no records. If it gets zero results, I'd like to skip over all the
instructions for printing and have it continue on to the next part of
the
report or to the end. Also, because it might leave the review file
empty
or not empty, the next time it runs I'd like it to be able to deal with
either of these cases (currently the script expects that the file will
not
be empty).
I have found examples of having the script send different things based
on
what it receives from the server, but nothing about branching to a
different part of the script based on what it receives. Thanks for any
help you can give me.
Phil
Phil Shirley
Technology Services Coordinator
Cuyahoga Falls Library
Cuyahoga Falls, Ohio
pshirley@xxxxxxxxxx
--
This message was distributed through the Innovative Users Group INNOPAC
list
Public replies: INNOPAC@xxxxxxxxxx
Update your subscription options:
http://innopacusers.org/mailman/listinfo/innopac
_______________________________________________________________________
This email has been scanned for all viruses.
_______________________________________________________________________
This email has been scanned for all viruses.