Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: helge.sauer [...] partner.bmw.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.14
Fixed in: (no value)



Subject: XMLout($data, $fh) breaks when $fh is a filehandle, not an IO::Handle object
When giving a "common" file handle as OutputFile value for XMLout, as described in the POD: open my $fh, '>:encoding(iso-8859-1)', $path or die "open($path): $!"; XMLout($ref, OutputFile => $fh); the script breaks with the error message: Can't locate object method "print" via package "IO::Handle" at /home/ccm_root/perl5.8/lib/5.8.6/XML/Simple.pm line 549. It seems that there should be a test whether $fh is an IO::Handle object or a file handle; in the latter case, a wrapper IO::Handle object should be created.
You simply need to include this line in your script: use IO::Handle; XML::Simple does not require that the object you pass in to the OutputFile parameter inherits from IO::Handle - it simply assumes the object supports a 'print' method. Regards Grant
Subject: AW: [rt.cpan.org #18929] XMLout($data, $fh) breaks when $fh is a filehandle, not an IO::Handle object
Date: Fri, 28 Apr 2006 14:46:21 +0200
To: <bug-XML-Simple [...] rt.cpan.org>
From: Helge Sauer <Helge.Sauer [...] partner.bmw.de>
You are right. Perhaps you could clarify the POD regarding this detail? (At first I tried copying the example from the POD and run into this problem. A friend finally explained to me what happens if "use IO::Handle" is included, but what if no Perl expert is at hand?) Thanks for the hint and best regards Helge Show quoted text
-----Ursprüngliche Nachricht----- Von: www-data@bestpractical.com [mailto:www-data@bestpractical.com] Im Auftrag von via RT Gesendet: Mittwoch, 26. April 2006 23:09 An: Sauer Helge, (Helge.Sauer@partner.bmw.de) Betreff: [rt.cpan.org #18929] XMLout($data, $fh) breaks when $fh is a filehandle, not an IO::Handle object <URL: http://rt.cpan.org/Ticket/Display.html?id=18929 > You simply need to include this line in your script: use IO::Handle; XML::Simple does not require that the object you pass in to the OutputFile parameter inherits from IO::Handle - it simply assumes the object supports a 'print' method. Regards Grant