Skip Menu |

This queue is for tickets about the OpenThought CPAN distribution.

Report information
The Basics
Id: 77883
Status: new
Priority: 0/
Queue: OpenThought

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

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



Subject: Incorrect use of length @ARRAY (warns in perl-5.16)
really, length apply to scalars, so length(@a) is actually length(scalar(@a)), so Show quoted text
> perl -E '@a = (); say length(@a)'
1 Show quoted text
> perl -E '@a = (1..9); say length(@a)'
1 Show quoted text
> perl -E '@a = (0..10); say length(@a)'
2 Attached patch fixes this by change length(@array) to scalar(@array) ;-)
Subject: ot_length_is_actually_scalar.patch
--- lib/OpenThought.pm 2012-06-18 23:04:00.140783750 +0400 +++ lib/OpenThought.pm 2012-06-18 23:07:58.539768956 +0400 @@ -761,7 +761,7 @@ sub response() { my $self = shift; - if ( length(@_) and ref $_[0] eq "HASH" ) { + if ( scalar @_ and ref $_[0] eq "HASH" ) { my $params = $_[0]; foreach my $param ( keys %{ $params } ) { @@ -771,7 +771,7 @@ else { my @params = @_; - #for my $i ( 1 .. (length @params) / 2) { + #for my $i ( 1 .. (scalar @params) / 2) { while ( scalar @params > 0 ) { my $method = shift @params;