use XML::LibXML;
use Try::Tiny;
-use Object::Tiny;
+use Object::Tiny qw{xmldoc config};
our $VERSION = '0.01';
our $nsURI = 'http://www.niso.org/2008/ncip';
my $self = shift;
my $xml = shift;
- my $request_type = $self->handle_initiation($xml);
+ my ($request_type) = $self->handle_initiation($xml);
unless ($request_type) {
# We have invalid xml, or we can't figure out what kind of request this is
#bail out for now
}
my $handler = NCIP::Handler->new($request_type);
- return $handler->handle($xml);
+ return $handler->handle( $self->xmldoc );
}
=head2 handle_initiation
# should check validity with validate at this point
if ( $self->validate($dom) ) {
my $request_type = $self->parse_request($dom);
+
# do whatever we should do to initiate, then hand back request_type
if ($request_type) {
+ $self->{xmldoc} = $dom;
return $request_type;
}
}
else {
warn "Not valid xml";
+
# not valid throw error
return;
}
#
# FILE: Hander.pm
#
-# DESCRIPTION:
+# DESCRIPTION:
#
# FILES: ---
# BUGS: ---
use Modern::Perl;
use Object::Tiny qw{ type };
-
use NCIP::Handler::LookupItem;
sub new {
- my $class = shift;
- my $type = shift;
- my $subclass = __PACKAGE__."::".$type;
- my $self = bless { type => $type }, $subclass;
+ my $class = shift;
+ my $type = shift;
+ my $xmldoc = shift;
+ my $subclass = __PACKAGE__ . "::" . $type;
+ my $self = bless { type => $type }, $subclass;
return $self;
}
#
# FILE: LookupItem.pm
#
-# DESCRIPTION:
+# DESCRIPTION:
#
# FILES: ---
# BUGS: ---
our @ISA = qw(NCIP::Handler);
sub handle {
- my $self = shift;
+ my $self = shift;
+ my $xmldoc = shift;
+ if ($xmldoc) {
+ # my ($item_id) = $dom->getElementsByTagNameNS( $nsURI, 'ItemId' );
+ }
+ des = $dom->getElementsByTagNameNS( $nsURI, 'NCIPMessage' );
return $self->type;
}