Skip Menu |
 

This queue is for tickets about the Apache-Session CPAN distribution.

Report information
The Basics
Id: 56329
Status: resolved
Priority: 0/
Queue: Apache-Session

People
Owner: Nobody in particular
Requestors: ianburrell [...] gmail.com
Cc:
AdminCc:

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



Subject: Apache::Session::Store::File stomps on $_
Download (untitled) / with headers
text/plain 342b
Apache::Session::Store::File has while (<$fh>) loop which uses $_. Since while does not localize $_, this stomps on any $_ values from loops in the caller. This leads to weird errors like "Modification of a read-only value" or values being unexpectedly modified. The solution is either localize $_ before the loop or use a lexical variable.
From: ianburrell [...] gmail.com
Patch to use lexical variable in problem loop.
Subject: file_while_localize.patch
# HG changeset patch # User Ian Burrell <imb@rentrak.com> # Date 1270579880 25200 # Node ID 58aa5e695a38779bc9bc41be5e887c6930739f24 # Parent b0eb3ef0fcea8e5d3ec9347a6473567135aa41a0 Change while loop to use lexical variable to avoid stomping on $_ diff -r b0eb3ef0fcea -r 58aa5e695a38 Session/Store/File.pm --- a/Session/Store/File.pm Tue Apr 06 11:43:05 2010 -0700 +++ b/Session/Store/File.pm Tue Apr 06 11:51:20 2010 -0700 @@ -85,8 +85,8 @@ } my $fh = $self->{fh}; - while (<$fh>) { - $session->{serialized} .= $_; + while (my $line = <$fh>) { + $session->{serialized} .= $line; } } else {


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.