From afd2ed1a461bbf73dbb080554e6b47537b3a2922 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Tue, 31 Dec 2013 09:31:33 +1300 Subject: [PATCH] Continuing with LookupItem --- lib/NCIP/Handler/LookupItem.pm | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/NCIP/Handler/LookupItem.pm b/lib/NCIP/Handler/LookupItem.pm index db2dbb8..e13bae8 100644 --- a/lib/NCIP/Handler/LookupItem.pm +++ b/lib/NCIP/Handler/LookupItem.pm @@ -13,7 +13,6 @@ package NCIP::Handler::LookupItem; =cut - use Modern::Perl; use NCIP::Handler; @@ -25,18 +24,25 @@ sub handle { my $self = shift; my $xmldoc = shift; if ($xmldoc) { + # Given our xml document, lets find the itemid my ($item_id) = $xmldoc->getElementsByTagNameNS( $self->namespace(), 'ItemIdentifierValue' ); - my $item = NCIP::Item->new( { itemid => $item_id->textContent(), ils => $self->ils} ); - my ($itemdata,$error) = $item->itemdata(); - if ($error){ -# handle error here + my $item = NCIP::Item->new( + { itemid => $item_id->textContent(), ils => $self->ils } ); + my ( $itemdata, $error ) = $item->itemdata(); + if ($error) { + + # handle error here } warn $item->itemid(); } - return $self->type; + my $vars; + $vars->{'messagetype'} = 'LookupItemResponse'; + $vars->{'item'} = $item; + my $output = $self->render_output( 'response.tt', $vars ); + return $output; } 1; -- 2.11.0