X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=lib%2FZOOM%2FIRSpy%2FRecord.pm;h=4f5ee8294dcc74aac72997aadd1e6146de6957e5;hb=8976789c74795ad9e92fe03e370e56501511426e;hp=5b7a4d0354d236b3ee4d105671d0ac9321ae3d04;hpb=4201443f5fb1eb4a214d2f1dfaa9f0983e6496fd;p=irspy-moved-to-github.git diff --git a/lib/ZOOM/IRSpy/Record.pm b/lib/ZOOM/IRSpy/Record.pm index 5b7a4d0..4f5ee82 100644 --- a/lib/ZOOM/IRSpy/Record.pm +++ b/lib/ZOOM/IRSpy/Record.pm @@ -1,4 +1,4 @@ -# $Id: Record.pm,v 1.3 2006-07-11 16:14:47 mike Exp $ +# $Id: Record.pm,v 1.5 2006-07-21 11:30:51 mike Exp $ package ZOOM::IRSpy::Record; @@ -6,17 +6,20 @@ use 5.008; use strict; use warnings; +use XML::LibXML; + + =head1 NAME ZOOM::IRSpy::Record - record describing a target for IRSpy =head1 SYNOPSIS - ### To follow + ## To follow =head1 DESCRIPTION -I<### To follow> +I<## To follow> =cut @@ -24,18 +27,34 @@ 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, # Do we actually need this for anything? + zeerex => $parser->parse_string($zeerex), }, $class; } -#use XML::Simple qw(:strict); -#my %attr = (KeyAttr => [], KeepRoot => 1); -#my $config = XMLin("foo.xml", %attr, ForceArray => 1, ForceContent => 1); -#print XMLout($config, %attr); +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