Skip Menu |

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

Report information
The Basics
Id: 67658
Status: resolved
Priority: 0/
Queue: XML-Parser

People
Owner: Nobody in particular
Requestors: RENEEB [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2.40
Fixed in: (no value)



Subject: Deprecation warning with Perl 5.14.0 RC1
Hi, I just tested to install XML::Parser with Perl 5.14.0 RC1 and I get the following deprecation warning: Use of tied on a handle without * is deprecated at /opt/perl5140rc1/lib/site_perl/5.14.0/i686-linux-thread-multi/XML/Parser/Expat.pm line 447. - Renee
The problem is a result of the use of bare word file handles in code. The problem here is primarily the use of FILE inside sub parsefile. More info can be found at these links: http://search.cpan.org/~jesse/perl-5.14.0/pod/perldelta.pod#Dereferencing_typeglobs http://rt.perl.org/rt3/Public/Bug/Display.html?id=77810 This patch resolves things.
Subject: patch.txt
diff --git a/Parser.pm b/Parser.pm index edf7856..dc827cb 100644 --- a/Parser.pm +++ b/Parser.pm @@ -215,9 +215,9 @@ sub parsestring { sub parsefile { my $self = shift; my $file = shift; - local(*FILE); - open(FILE, $file) or croak "Couldn't open $file:\n$!"; - binmode(FILE); + + open(my $fh, $file) or croak "Couldn't open $file:\n$!"; + binmode($fh); my @ret; my $ret; @@ -225,16 +225,16 @@ sub parsefile { if (wantarray) { eval { - @ret = $self->parse(*FILE, @_); + @ret = $self->parse($fh, @_); }; } else { eval { - $ret = $self->parse(*FILE, @_); + $ret = $self->parse($fh, @_); }; } my $err = $@; - close(FILE); + close($fh); die $err if $err; return unless defined wantarray; diff --git a/t/stream.t b/t/stream.t index 92b7994..6a5c140 100644 --- a/t/stream.t +++ b/t/stream.t @@ -32,19 +32,19 @@ close(OUT); my $parser = new XML::Parser(Stream_Delimiter => $delim, Handlers => {Comment => sub {$cnt++;}}); -open(FOO, $tmpfile); +open($FOO, $tmpfile); -$parser->parse(*FOO); +$parser->parse($FOO); print "not " if ($cnt != 37); print "ok 2\n"; $cnt = 0; -$parser->parse(*FOO); +$parser->parse($FOO); print "not " if ($cnt != 37); print "ok 3\n"; -close(FOO); +close($FOO); unlink($tmpfile);
Looks like this ticket should be merged with RT 67207 as a dupe. They provide an alternate patch.
Please see RT 67207 for a resolution.