package NCIP;
use NCIP::Configuration;
use Modern::Perl;
-
-
-use FileHandle;
+use base qw(Class::Accessor);
sub new {
- my $self = shift;
- my $config_file = shift;
-
- my $config = NCIP::Configuration->new($config_file);
- return bless $config, $self;
+ my $proto = shift;
+ my $class = ref $proto || $proto;
+ my $config_dir = shift;
+ my $self = {};
+ my $config = NCIP::Configuration->new($config_dir);
+ $self->{config} = $config;
+ return bless $self, $class;
}
sub process_request {
my $self = shift;
my $xml = shift;
-
+
+ my $request_type = $self->handle_initiation($xml);
my $response = "<HTML> <HEAD> <TITLE>Hello There</TITLE> </HEAD> <BODY> <H1>Hello You Big JERK!</H1> Who would take this book seriously if the first eaxample didn't say \"hello world\"? </BODY> </HTML>";
return $response;
}
+sub handle_initiation {
+ my $self = shift;
+ my $xml = shift;
+
+ return('lookup_item');
+}
+
1;
--- /dev/null
+#
+#===============================================================================
+#
+# FILE: NCIP.t
+#
+# DESCRIPTION:
+#
+# FILES: ---
+# BUGS: ---
+# NOTES: ---
+# AUTHOR: Chris Cormack (rangi), chrisc@catalyst.net.nz
+# ORGANIZATION: Koha Development Team
+# VERSION: 1.0
+# CREATED: 18/09/13 09:59:01
+# REVISION: ---
+#===============================================================================
+
+use strict;
+use warnings;
+
+use Test::More tests => 3; # last test to print
+
+use lib 'lib';
+
+use_ok('NCIP');
+ok( my $ncip = NCIP->new('t/config_sample'), 'Create new object' );
+
+my $xml = <<'EOT';
+<xml>
+</xml>
+EOT
+
+ok( my $response = $ncip->process_request($xml), 'Process a request' );
+