Help for z39.50 search in proquest dissertations and theses

2008-02-18 Thread Anne L. Highsmith
I am trying to create a perl program using Net::Z3950 to connect to and search 
the proquest dissertations and theses database. I can connect and search via 
YAZ, but am having no luck via perl/Net::Z3950.

Here's the perl program:
use Net::Z3950;
$mgr = new Net::Z3950::Manager(
user=>'[user]',
pass=>'[password]',
);
$target = 'proquest-z3950.umi.com';
$port = '210';
$database = 'PQD';
$recordSyntax = 'SUTRS';
$conn = new Net::Z3950::Connection($mgr, $target, $port, databaseName 
=>$database) or die "$!\n";
$rs = $conn->search(-prefix => '@and @attr 1=4 steamboat bertrand') or die 
"$!\n";
$count = $rs->size();
print "$count\n" and die;

When I have the "$!\n"; in the '$rs = ' line, I always get the message 
"Operation in progress". 
When I remove the "$!\n"; in the '$rs = ' line, and it falls through to $count 
= $rs->size(); , I get:
Can't call method "size" on an undefined value at ./zd line 13.
---
The sequence of commands from the corresponding YAZ session, which is 
successful, follows. Can anyone suggest why the perl program is failing on what 
appears to be an identical sequence in YAZ?
---
Z> open proquest-z3950.umi.com:210/PQD
Connecting...OK.
Sent initrequest.
Connection accepted by v3 target.
ID : 1996
Name   : ProQuest Information and Learning
Version: 1.0
UserInformationfield:
{
OID: 1 2 840 10003 10 1000 17 1
{
ANY (len=49)
}
}
OCLC UserInformation:
{
motd 'Welcome to the ProQuest Z39.50 Gateway'
dblist {
'PQD'
}
}
Options: search present scan namedResultSets
Z> find @and @attr 1=4 steamboat bertrand
Sent searchRequest.
Received SearchResponse.
Search was a success.
Number of hits: 1, setno 1

Anne L. Highsmith
Consortia Systems Coordinator
5000 TAMU
Evans Library
Texas A&M University
College Station, TX   77843-5000
[EMAIL PROTECTED]
979-862-4234
979-845-6238 (fax) 



Re: Help for z39.50 search in proquest dissertations and theses

2008-02-19 Thread Ashley Sanders

Anne L. Highsmith wrote:

I am trying to create a perl program using Net::Z3950 to connect to and search 
the proquest dissertations and theses database. I can connect and search via 
YAZ, but am having no luck via perl/Net::Z3950.

Here's the perl program:
use Net::Z3950;
$mgr = new Net::Z3950::Manager(
user=>'[user]',
pass=>'[password]',
);



$target = 'proquest-z3950.umi.com';
$port = '210';
$database = 'PQD';
$recordSyntax = 'SUTRS';
$conn = new Net::Z3950::Connection($mgr, $target, $port, databaseName =>$database) or die 
"$!\n";
$rs = $conn->search(-prefix => '@and @attr 1=4 steamboat bertrand') or die 
"$!\n";
$count = $rs->size();
print "$count\n" and die;

When I have the "$!\n"; in the '$rs = ' line, I always get the message "Operation in progress". 
When I remove the "$!\n"; in the '$rs = ' line, and it falls through to $count = $rs->size(); , I get:

Can't call method "size" on an undefined value at ./zd line 13.


I've never used Net::Z3950, but my understanding of the Manager
class is that it is that connection is being made
asynchronously -- which means you need to use the wait()
function, as in the example here:

   http://perl.z3950.org/docs/Z3950/Manager.html

You could try adding "async => 0" to the Manager object
construction, ie:

$mgr = new Net::Z3950::Manager(async => 0, user => xxx, pass => yyy);

or perhaps adding it here instead:

  $conn = new Net::Z3950::Connection($mgr, $host, $port, async => 0);

Hope this helps,

Regards,

Ashley.
--
Ashley Sanders   [EMAIL PROTECTED]
Copac http://copac.ac.uk A Mimas service funded by JISC


Re: Help for z39.50 search in proquest dissertations and theses--new question

2008-02-19 Thread Anne L. Highsmith
I discovered the solution to my first problem. It appears that the proquest 
server is funky (?)  in that you need to set the record format before executing 
the search.  So, I just needed to add a line after the connection string, i.e.
$conn = new Net::Z3950::Connection($mgr, $target, $port, databaseName 
=>$database) or die "$!\n";
$conn->option(preferredRecordSyntax => Net::Z3950::RecordSyntax::SUTRS);

After doing that I received a single record in the result set, as expected, in 
this test situation.

But now I have a new problem -- I can't get the record to print, using either 
render or rawdata.  Here are my instructions for printing and the error message 
that I receive :
for ( $i = 1; $i <= $rs->size(); $i++ ) {
$rec = $rs->record($i);
print $rec->rawdata();
}

FATAL (yazwrap): can't translate record of unknown RS
Abort

It appears that the program can't handle the record at all. Even when I delete 
attempts to print the record, I get the same thing.
for ( $i = 1; $i <= $rs->size(); $i++ ) {
$rec = $rs->record($i);
}
FATAL (yazwrap): can't translate record of unknown RS
Abort

I have poked around on the Internet and found some posts from Mike Taylor 
(author of Z39.50?) about similar problems, so I added an elementSetName 
statement, but it still didn't help. Here's the complete, current program:

#!/exlibris/sfx_ver/sfx_version_3/app/perl/bin/perl
use Net::Z3950;
$mgr = new Net::Z3950::Manager(
user=>'[user]',
pass=>'[password]',
);
$target = 'proquest-z3950.umi.com';
$port = '210';
$database = 'PQD';
$conn = new Net::Z3950::Connection($mgr, $target, $port, databaseName 
=>$database) or die "$!\n";
$conn->option(preferredRecordSyntax => Net::Z3950::RecordSyntax::SUTRS);
$rs = $conn->search(-prefix => '@and @attr 1=4 steamboat bertrand');
$rs->option(elementSetName => "B");
my $count = $rs->size();
for ( $i = 1; $i <= $rs->size(); $i++ ) {
$rec = $rs->record($i);
print $rec->rawdata();
}


Anybody have any suggestions, I hope?


Anne L. Highsmith
Consortia Systems Coordinator
5000 TAMU
Evans Library
Texas A&M University
College Station, TX   77843-5000
[EMAIL PROTECTED]
979-862-4234
979-845-6238 (fax) 

>>> "Anne L. Highsmith" <[EMAIL PROTECTED]> 2/18/2008 2:25 PM >>>
I am trying to create a perl program using Net::Z3950 to connect to and search 
the proquest dissertations and theses database. I can connect and search via 
YAZ, but am having no luck via perl/Net::Z3950.

Here's the perl program:
use Net::Z3950;
$mgr = new Net::Z3950::Manager(
user=>'[user]',
pass=>'[password]',
);
$target = 'proquest-z3950.umi.com';
$port = '210';
$database = 'PQD';
$recordSyntax = 'SUTRS';
$conn = new Net::Z3950::Connection($mgr, $target, $port, databaseName 
=>$database) or die "$!\n";
$rs = $conn->search(-prefix => '@and @attr 1=4 steamboat bertrand') or die 
"$!\n";
$count = $rs->size();
print "$count\n" and die;

When I have the "$!\n"; in the '$rs = ' line, I always get the message 
"Operation in progress". 
When I remove the "$!\n"; in the '$rs = ' line, and it falls through to $count 
= $rs->size(); , I get:
Can't call method "size" on an undefined value at ./zd line 13.
---
The sequence of commands from the corresponding YAZ session, which is 
successful, follows. Can anyone suggest why the perl program is failing on what 
appears to be an identical sequence in YAZ?
---
Z> open proquest-z3950.umi.com:210/PQD
Connecting...OK.
Sent initrequest.
Connection accepted by v3 target.
ID : 1996
Name   : ProQuest Information and Learning
Version: 1.0
UserInformationfield:
{
OID: 1 2 840 10003 10 1000 17 1
{
ANY (len=49)
}
}
OCLC UserInformation:
{
motd 'Welcome to the ProQuest Z39.50 Gateway'
dblist {
'PQD'
}
}
Options: search present scan namedResultSets
Z> find @and @attr 1=4 steamboat bertrand
Sent searchRequest.
Received SearchResponse.
Search was a success.
Number of hits: 1, setno 1

Anne L. Highsmith
Consortia Systems Coordinator
5000 TAMU
Evans Library
Texas A&M University
College Station, TX   77843-5000
[EMAIL PROTECTED] 
979-862-4234
979-845-6238 (fax)