From: Kostas C. <ko...@ch...> - 2008-02-28 18:38:50
|
Hello, I'd like to report a bug in SOAP::Serializer (appeared, as far as I can tell, in version 0.65-beta6), that prevents XMLRPC::Serializer from being subclassed. From SOAP::Serializer::encode_object } elsif (UNIVERSAL::isa($object => 'ARRAY')) { # Added in SOAP::Lite 0.65_6 to fix an XMLRPC bug return $self->encodingStyle eq "" || ref $self eq 'XMLRPC::Serializer' ? $self->encode_array($object, $name, $type, $attr) : $self->encode_literal_array($object, $name, $type, $attr); if you use My::Serializer instead of XMLRPC::Serializer, then the test $self eq 'XMLRPC::Serializer' will fail and arrays will not be encoded correctly. A simple fix is to change the test to UNIVERSAL::isa($self, 'XMLRPC::Serializer') Another comment wrt subclassing the serializers: many functions call new() on an object, due do statements of the form: my $self = shift->new; As a consequence, when you subclass a serializer your constructor is called multiple times, unless you add a test like return $self if ref $self; This is an unnatural behaviour and should be written in the documentation. Or better, these statements should be replaced by the faster and saner: my $self = ref $_[0] ? shift : shift->new; or something similar. That's all for now. Thanks a lot for this great module. I was also pleased to see the announcement of 0.70 and the recent activity in the mailing list. Kostas |