From 058ffa9dae5f9e21a8debfd85db13d12fe66d9b5 Mon Sep 17 00:00:00 2001 From: miker Date: Thu, 11 Aug 2005 19:37:13 +0000 Subject: [PATCH] testing reveals bugs, bugs get squashed! git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@470 9efc2488-bf62-4759-914b-345cdb29e865 --- src/perlmods/OpenSRF/DomainObject/oilsMessage.pm | 9 ++++++++- src/perlmods/OpenSRF/DomainObject/oilsMethod.pm | 9 ++++++++- src/perlmods/OpenSRF/DomainObject/oilsResponse.pm | 19 +++++++++++++++---- .../OpenSRF/Transport/SlimJabber/MessageWrapper.pm | 2 +- 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/perlmods/OpenSRF/DomainObject/oilsMessage.pm b/src/perlmods/OpenSRF/DomainObject/oilsMessage.pm index f3f6daa..320f79a 100644 --- a/src/perlmods/OpenSRF/DomainObject/oilsMessage.pm +++ b/src/perlmods/OpenSRF/DomainObject/oilsMessage.pm @@ -6,7 +6,7 @@ use OpenSRF::Utils::Logger qw/:level/; use warnings; use strict; use OpenSRF::EX qw/:try/; -JSON->register_class_hint(hint => 'osrfMessage', class => 'OpenSRF::DomainObject::oilsMessage'); +JSON->register_class_hint(hint => 'osrfMessage', name => 'OpenSRF::DomainObject::oilsMessage', type => 'hash'); sub toString { my $self = shift; @@ -15,6 +15,13 @@ sub toString { return JSON->perl2JSON($self); } +sub new { + my $self = shift; + my $class = ref($self) || $self; + my %args = @_; + return bless \%args => $class; +} + =head1 NAME diff --git a/src/perlmods/OpenSRF/DomainObject/oilsMethod.pm b/src/perlmods/OpenSRF/DomainObject/oilsMethod.pm index 16134a4..6c81902 100644 --- a/src/perlmods/OpenSRF/DomainObject/oilsMethod.pm +++ b/src/perlmods/OpenSRF/DomainObject/oilsMethod.pm @@ -1,7 +1,7 @@ package OpenSRF::DomainObject::oilsMethod; use JSON; -JSON->register_class_hint(hint => 'osrfMethod', class => 'OpenSRF::DomainObject::oilsMethod'); +JSON->register_class_hint(hint => 'osrfMethod', name => 'OpenSRF::DomainObject::oilsMethod', type => 'hash'); sub toString { my $self = shift; @@ -10,6 +10,13 @@ sub toString { return JSON->perl2JSON($self); } +sub new { + my $self = shift; + my $class = ref($self) || $self; + my %args = @_; + return bless \%args => $class; +} + =head1 NAME diff --git a/src/perlmods/OpenSRF/DomainObject/oilsResponse.pm b/src/perlmods/OpenSRF/DomainObject/oilsResponse.pm index 59f6138..5e69691 100644 --- a/src/perlmods/OpenSRF/DomainObject/oilsResponse.pm +++ b/src/perlmods/OpenSRF/DomainObject/oilsResponse.pm @@ -5,7 +5,7 @@ use JSON; use base qw/Exporter/; use OpenSRF::Utils::Logger qw/:level/; -JSON->register_class_hint( hint => 'osrfResponse', class => 'OpenSRF::DomainObject::oilsResponse' ); +JSON->register_class_hint( hint => 'osrfResponse', name => 'OpenSRF::DomainObject::oilsResponse', type => 'hash' ); BEGIN { @EXPORT_OK = qw/STATUS_CONTINUE STATUS_OK STATUS_ACCEPTED @@ -79,8 +79,8 @@ sub toString { } sub new { - my $class = shift; - $class = ref($class) || $class; + my $name = shift; + $name = ref($class) || $class; my $default_status = eval "\$${class}::status"; my $default_statusCode = eval "\$${class}::statusCode"; @@ -115,6 +115,7 @@ package OpenSRF::DomainObject::oilsStatus; use OpenSRF::DomainObject::oilsResponse qw/:status/; use base 'OpenSRF::DomainObject::oilsResponse'; use vars qw/$status $statusCode/; +JSON->register_class_hint( hint => 'osrfStatus', name => 'OpenSRF::DomainObject::oilsStatus', type => 'hash' ); =head1 NAME @@ -145,6 +146,7 @@ package OpenSRF::DomainObject::oilsConnectStatus; use OpenSRF::DomainObject::oilsResponse qw/:status/; use base 'OpenSRF::DomainObject::oilsStatus'; use vars qw/$status $statusCode/; +JSON->register_class_hint( hint => 'osrfConnectStatus', name => 'OpenSRF::DomainObject::oilsConnectStatus', type => 'hash' ); =head1 NAME @@ -182,6 +184,7 @@ package OpenSRF::DomainObject::oilsContinueStatus; use OpenSRF::DomainObject::oilsResponse qw/:status/; use base 'OpenSRF::DomainObject::oilsStatus'; use vars qw/$status $statusCode/; +JSON->register_class_hint( hint => 'osrfContinueStatus', name => 'OpenSRF::DomainObject::oilsContinueStatus', type => 'hash' ); =head1 NAME @@ -224,6 +227,7 @@ use OpenSRF::DomainObject::oilsResponse qw/:status/; use OpenSRF::DomainObject::oilsPrimitive; use base 'OpenSRF::DomainObject::oilsResponse'; use vars qw/$status $statusCode/; +JSON->register_class_hint( hint => 'osrfResult', name => 'OpenSRF::DomainObject::oilsResult', type => 'hash' ); $status = 'OK'; @@ -292,6 +296,7 @@ use OpenSRF::EX; use base qw/OpenSRF::EX OpenSRF::DomainObject::oilsResponse/; use vars qw/$status $statusCode/; use Error; +JSON->register_class_hint( hint => 'osrfException', name => 'OpenSRF::DomainObject::oilsException', type => 'hash' ); sub message { my $self = shift; @@ -299,7 +304,7 @@ sub message { } sub new { - my $class = shift; + my $name = shift; return $class->OpenSRF::DomainObject::oilsResponse::new( @_ ); } @@ -334,6 +339,7 @@ use OpenSRF::DomainObject::oilsResponse qw/:status/; use OpenSRF::EX; use base qw/OpenSRF::DomainObject::oilsException OpenSRF::EX::ERROR/; use vars qw/$status $statusCode/; +JSON->register_class_hint( hint => 'osrfConnectException', name => 'OpenSRF::DomainObject::oilsConnectException', type => 'hash' ); =head1 NAME @@ -369,6 +375,7 @@ package OpenSRF::DomainObject::oilsMethodException; use OpenSRF::DomainObject::oilsResponse qw/:status/; use base 'OpenSRF::DomainObject::oilsException'; use vars qw/$status $statusCode/; +JSON->register_class_hint( hint => 'osrfMethodException', name => 'OpenSRF::DomainObject::oilsMethodException', type => 'hash' ); =head1 NAME @@ -407,6 +414,7 @@ package OpenSRF::DomainObject::oilsServerError; use OpenSRF::DomainObject::oilsResponse qw/:status/; use base 'OpenSRF::DomainObject::oilsException'; use vars qw/$status $statusCode/; +JSON->register_class_hint( hint => 'osrfServerError', name => 'OpenSRF::DomainObject::oilsServerError', type => 'hash' ); $status = 'Internal Server Error'; $statusCode = STATUS_INTERNALSERVERERROR; @@ -422,6 +430,7 @@ use OpenSRF::DomainObject::oilsResponse qw/:status/; use OpenSRF::EX; use base qw/OpenSRF::DomainObject::oilsException OpenSRF::EX::ERROR/; use vars qw/$status $statusCode/; +JSON->register_class_hint( hint => 'osrfBrokenSession', name => 'OpenSRF::DomainObject::oilsBrokenSession', type => 'hash' ); $status = "Request on Disconnected Session"; $statusCode = STATUS_EXPFAILED; @@ -430,6 +439,7 @@ use OpenSRF::DomainObject::oilsResponse qw/:status/; use OpenSRF::EX; use base qw/OpenSRF::DomainObject::oilsException OpenSRF::EX::ERROR/; use vars qw/$status $statusCode/; +JSON->register_class_hint( hint => 'osrfXMLParseError', name => 'OpenSRF::DomainObject::oilsXMLParseError', type => 'hash' ); $status = "XML Parse Error"; $statusCode = STATUS_EXPFAILED; @@ -437,6 +447,7 @@ package OpenSRF::DomainObject::oilsAuthException; use OpenSRF::DomainObject::oilsResponse qw/:status/; use OpenSRF::EX; use base qw/OpenSRF::DomainObject::oilsException OpenSRF::EX::ERROR/; +JSON->register_class_hint( hint => 'osrfAuthException', name => 'OpenSRF::DomainObject::oilsAuthException', type => 'hash' ); use vars qw/$status $statusCode/; $status = "Authentication Failure"; $statusCode = STATUS_FORBIDDEN; diff --git a/src/perlmods/OpenSRF/Transport/SlimJabber/MessageWrapper.pm b/src/perlmods/OpenSRF/Transport/SlimJabber/MessageWrapper.pm index 3711e6c..b792721 100644 --- a/src/perlmods/OpenSRF/Transport/SlimJabber/MessageWrapper.pm +++ b/src/perlmods/OpenSRF/Transport/SlimJabber/MessageWrapper.pm @@ -14,7 +14,7 @@ sub new { } else { $doc = XML::LibXML::Document->createDocument; $msg = $doc->createElement( 'message' ); - $doc->documentElement->appendChild( $msg ); + $doc->setDocumentElement( $msg ); } -- 2.11.0