Dominique Dumont wrote :
> On Friday 17 May 2013 06:44:46 Xavier wrote:
>> According to https://rt.cpan.org/Public/Bug/Display.html?id=62667 this
>> is not a bug and the Debian patch must be removed.
> 
> OTOH, UNIVERSAL doc mentions:
> 
>            # but never do this!
>            $is_io    = UNIVERSAL::isa($fd, "IO::Handle");
>            $sub      = UNIVERSAL::can($obj, "print");
> 
> 
> I think an alternative is suggested at the end of this man page:
> 
>    Instead, use "reftype" from Scalar::Util for the first case:
> 
>          use Scalar::Util 'reftype';
> 
>          $yes = reftype( $h ) eq "HASH";
> 
> reftype never returns a class name, it always returns the type of the 
> structure hidden behind an object.
> 
> Can you modify the patch and test that it works ?
> 
> If yes, we will be able to submit another patch to upstream.

Hi,

I've written it but the example continue to fail. So with a debug, I've
found something strange : $values contains a ref to a hashref. So I've
written a new patch

Xavier

Author: Ashish Shukla <wahj...@members.fsf.org>
Subject: use 'ref' rather than 'UNIVERSAL::isa'
Reviewed-by: Xavier Guimard <x.guim...@free.fr>
Last-Update: 2010-11-03
Bug: http://rt.cpan.org/Ticket/Display.html?id=62667
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=602056
Last-Update: 2013-05-18

--- a/lib/SOAP/Lite.pm
+++ b/lib/SOAP/Lite.pm
@@ -3818,15 +3818,28 @@
                 my($value) = $_->value; # take first value
 
                 # fillup parameters
-                UNIVERSAL::isa($_[$param] => 'SOAP::Data')
-                    ? $_[$param]->SOAP::Data::value($value)
-                    : UNIVERSAL::isa($_[$param] => 'ARRAY')
-                        ? (@{$_[$param]} = @$value)
-                        : UNIVERSAL::isa($_[$param] => 'HASH')
-                            ? (%{$_[$param]} = %$value)
-                            : UNIVERSAL::isa($_[$param] => 'SCALAR')
-                                ? (${$_[$param]} = $$value)
-                                : ($_[$param] = $value)
+                use Scalar::Util 'reftype';
+                if ( reftype( $_[$param] ) ) {
+                    if ( reftype( $_[$param] ) eq 'SCALAR' ) {
+                        ${ $_[$param] } = $$value;
+                    }
+                    elsif ( reftype( $_[$param] ) eq 'ARRAY' ) {
+                        @{ $_[$param] } = @$value;
+                    }
+                    elsif ( reftype( $_[$param] ) eq 'HASH' ) {
+                        if ( eval { $_[$param]->isa('SOAP::Data') } ) {
+                            $_[$param]->SOAP::Data::value($value);
+                        }
+                        elsif ( reftype($value) eq 'REF' ) {
+                            %{ $_[$param] } = %$$value;
+                        }
+                        else { %{ $_[$param] } = %$value; }
+                    }
+                    else { $_[$param] = $value; }
+                }
+                else {
+                    $_[$param] = $value;
+                }
             }
         }
     }

Reply via email to