Skip Menu |
 
rt.cpan.org will be shut down on March 1st, 2021.

This queue is for tickets about the XML-Simple CPAN distribution.

Report information
The Basics
Id: 31074
Status: rejected
Priority: 0/
Queue: XML-Simple

People
Owner: Nobody in particular
Requestors: jloverso [...] mathworks.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 2.16
  • 2.18
Fixed in: (no value)



Subject: XML::Simple breaks when the perl profiler is used
Download (untitled) / with headers
text/plain 1.1k
If 'perl -d:DProf' is used on a script using XML::Simple, calls to $xs->XMLin() will fail with 'Options must be name=>value pairs (odd number supplied)'. This is because Devel::DProf injects code at the start/end of subroutine calls, and it breaks the aliasing of @_ that calling &_get_object depends upon. However, a simply fixing _get_object() to explicitly be passed a ref to the arg list (so it can still shift it) fixes the problem. With this change, every call it must be changed to read: my $self = _get_object(\@_); (there are 2 such calls in 2.16 and 5 in 2.18) --- XML-Simple/lib/XML/Simple.pm.orig 2006-10-30 03:28:13.000000000 -0500 +++ XML-Simple/lib/XML/Simple.pm 2007-11-29 11:02:34.000000000 -0500 @@ -137,9 +137,10 @@ # sub _get_object { - my $self; - if($_[0] and UNIVERSAL::isa($_[0], 'XML::Simple')) { - $self = shift; + my $self = shift; + + if($self->[0] and UNIVERSAL::isa($self->[0], 'XML::Simple')) { + $self = shift @$self; } else { $self = XML::Simple->new(); @@ -160,7 +161,7 @@ # sub XMLin { - my $self = &_get_object; # note, @_ is passed implicitly + my $self = _get_object(\@_); my $string = shift;
Subject: XML-Simple.patch
Download XML-Simple.patch
text/x-diff 609b
--- XML-Simple/lib/XML/Simple.pm.orig 2006-10-30 03:28:13.000000000 -0500 +++ XML-Simple/lib/XML/Simple.pm 2007-11-29 11:02:34.000000000 -0500 @@ -137,9 +137,10 @@ # sub _get_object { - my $self; - if($_[0] and UNIVERSAL::isa($_[0], 'XML::Simple')) { - $self = shift; + my $self = shift; + + if($self->[0] and UNIVERSAL::isa($self->[0], 'XML::Simple')) { + $self = shift @$self; } else { $self = XML::Simple->new(); @@ -160,7 +161,7 @@ # sub XMLin { - my $self = &_get_object; # note, @_ is passed implicitly + my $self = _get_object(\@_); my $string = shift;
Download (untitled) / with headers
text/plain 116b
This problem is with Devel::DProf and as it doesn't occur with Devel::NYTprof I don't really wish to change my code.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.