# load the ILS dependent module
my $module = 'NCIP::ILS::' . $config->('NCIP.ils.value');
load $module || die "Can not load ILS module $module";
- my $ils = $module->new( name => $config->('NCIP.ils.value') );
+ my $ils = $module->new( name => $config->('NCIP.ils.value') );
$self->{'ils'} = $ils;
return bless $self, $class;
#bail out for now
}
- my $handler = NCIP::Handler->new( $self->namespace(), $request_type );
+ my $handler = NCIP::Handler->new(
+ {
+ namespace => $self->namespace(),
+ type => $request_type,
+ ils => $self->ils
+ }
+ );
return $handler->handle( $self->xmldoc );
}
#===============================================================================
use Modern::Perl;
-use Object::Tiny qw{ type namespace };
+use Object::Tiny qw{ type namespace ils };
use NCIP::Handler::LookupItem;
sub new {
- my $class = shift;
- my $namespace = shift;
- my $type = shift;
- my $subclass = __PACKAGE__ . "::" . $type;
- my $self = bless { type => $type, namespace => $namespace }, $subclass;
+ my $class = shift;
+ my $params = shift;
+ my $subclass = __PACKAGE__ . "::" . $params->{type};
+ my $self = bless {
+ type => $params->{type},
+ namespace => $params->{namespace},
+ ils => $params->{ils}
+ }, $subclass;
return $self;
}
my ($item_id) =
$xmldoc->getElementsByTagNameNS( $self->namespace(),
'ItemIdentifierValue' );
- my $item = NCIP::Item->new( { itemid => $item_id->textContent() } );
+ my $item = NCIP::Item->new( { itemid => $item_id->textContent(), ils => $self->ils} );
warn $item->itemid();
}
return $self->type;
use lib 'lib';
use_ok('NCIP::Handler');
-my $namespace='http://test';
+my $namespace = 'http://test';
my $type = 'LookupItem';
-ok( my $handler = NCIP::Handler->new($namespace, $type), 'Create new handler' );
+ok(
+ my $handler =
+ NCIP::Handler->new( { namespace => $namespace, type => $type } ),
+ 'Create new handler'
+);
ok( my $response = $handler->handle() );