Continuing with LookupItem
authorChris Cormack <chrisc@catalyst.net.nz>
Mon, 30 Dec 2013 20:31:33 +0000 (09:31 +1300)
committerChris Cormack <chrisc@catalyst.net.nz>
Mon, 30 Dec 2013 20:31:33 +0000 (09:31 +1300)
lib/NCIP/Handler/LookupItem.pm

index db2dbb8..e13bae8 100644 (file)
@@ -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;