Skip Menu |

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

Report information
The Basics
Id: 115922
Status: new
Priority: 0/
Queue: XML-Smart

People
Owner: Nobody in particular
Requestors: vbuttazzo [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.79
Fixed in: (no value)



Subject: Buggy ->content method in array context
There is a very annoying problem with the content() method in array context. This 2 rows will end in a "Can't use string ("my content") as an ARRAY ref while "strict refs" in use at /usr/local/share/perl5/XML/Smart.pm line 1423.": use XML::Smart; print XML::Smart->new('<foo>my content</foo>')->{foo}->content; As a quick fix I would suggest to replace this code at the end of the content() sub: if( wantarray ) { return @{ $content_to_return } ; } else { return $content_to_return ; } with this one: if( wantarray and ref $content_to_return eq 'ARRAY') { return @{ $content_to_return } ; } else { return $content_to_return ; } Maybe not totally correct, but it definitely works.