Skip Menu |
 

This queue is for tickets about the Encode CPAN distribution.

Report information
The Basics
Id: 80181
Status: resolved
Priority: 0/
Queue: Encode

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

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



Subject: Uninitialized value warning from Encode->encodings()
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 800
Download (untitled) / with headers
text/plain 800b
The docs document this as a method call, but if you call it as a method with no additional arguments you get: Use of uninitialized value $_[1] in string eq at /home/autarch/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2/x86_64- linux/Encode.pm line 65. The problem is this code: if ( @_ and $_[1] eq ":all" ) { ... } When called as a method, @_ is always true. The rest of the internals seem to suggest that you _don't_ expect this sub to be called as a method, since you access "@_" without shifting anything off. I think you really need to shift off the first argument like you were doing before, either that or document this as a backwards incompatible change and document calling this as a sub, not a method. But this seems like something that's not worth breaking back compat for.
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-10392-1361150901-483.80181-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 1231
Download (untitled) / with headers
text/plain 1.2k
Thank you. Fixed as follows. Dan the Maintainer Thereof --- Encode.pm 2012/08/15 05:36:16 2.47 +++ Encode.pm 2013/02/18 01:25:27 @@ -62,7 +62,8 @@ sub encodings { my %enc; - if ( @_ and $_[1] eq ":all" ) { + my ( $class, $arg ) = @_; + if ( $arg eq ":all" ) { %enc = ( %Encoding, %ExtModule ); } else { On Sun Oct 14 16:06:34 2012, DROLSKY wrote: Show quoted text
> The docs document this as a method call, but if you call it as a method > with no additional arguments you get: > > Use of uninitialized value $_[1] in string eq at > /home/autarch/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2/x86_64- > linux/Encode.pm line 65. > > The problem is this code: > > if ( @_ and $_[1] eq ":all" ) { ... } > > When called as a method, @_ is always true. > > The rest of the internals seem to suggest that you _don't_ expect this > sub to be called as a method, since you access "@_" without shifting > anything off. > > I think you really need to shift off the first argument like you were > doing before, either that or document this as a backwards incompatible > change and document calling this as a sub, not a method. But this seems > like something that's not worth breaking back compat for.


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.