X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=lib%2FZOOM%2FIRSpy%2FRecord.pm;h=4fe751b5a419dd6a1e6dc9fe18bc2801a92a9802;hb=1c872700aed472f8411c8b4fb6fb72fdb5986097;hp=db1b8659fd8867e8059467d04d7647c80e0ce0d6;hpb=c3fa325a38274107a241d301a40a3c8fd1c21779;p=irspy-moved-to-github.git diff --git a/lib/ZOOM/IRSpy/Record.pm b/lib/ZOOM/IRSpy/Record.pm index db1b865..4fe751b 100644 --- a/lib/ZOOM/IRSpy/Record.pm +++ b/lib/ZOOM/IRSpy/Record.pm @@ -1,14 +1,17 @@ -# $Id: Record.pm,v 1.1 2006-06-20 12:28:26 mike Exp $ +# $Id: Record.pm,v 1.4 2006-07-18 11:09:51 mike Exp $ -package Net::Z3950::IRSpy::Record; +package ZOOM::IRSpy::Record; use 5.008; use strict; use warnings; +use XML::LibXML; + + =head1 NAME -Net::Z3950::IRSpy::Record - record describing a target for IRSpy +ZOOM::IRSpy::Record - record describing a target for IRSpy =head1 SYNOPSIS @@ -24,17 +27,39 @@ sub new { my $class = shift(); my($target, $zeerex) = @_; - ### Should compile the ZeeRex record into something useful. + if (!defined $zeerex) { + $zeerex = _empty_zeerex_record($target); + } + + my $parser = new XML::LibXML(); return bless { target => $target, - zeerex => $zeerex, + zeerex => $parser->parse_string($zeerex), }, $class; } +sub _empty_zeerex_record { + my($target) = @_; + + ### Doesn't recognise SRU/SRW URLs + my($host, $port, $db) = ZOOM::IRSpy::_parse_target_string($target); + + return <<__EOT__; + + + $host + $port + $db + + +__EOT__ +} + + =head1 SEE ALSO -Net::Z3950::IRSpy +ZOOM::IRSpy =head1 AUTHOR