develooper Front page | perl.perl5.porters | Postings from October 2013

[perl #120102] CORE::select ignoring timeout var's magic

Thread Previous | Thread Next
From:
James E Keenan via RT
Date:
October 4, 2013 23:15
Subject:
[perl #120102] CORE::select ignoring timeout var's magic
Message ID:
rt-3.6.HEAD-26210-1380928534-1186.120102-15-0@perl.org
On Fri Oct 04 14:10:47 2013, sanko wrote:
> This is a bug report for perl from sanko@cpan.org,
> generated with the help of perlbug 1.39 running under perl 5.16.3.
> 
> 
> -----------------------------------------------------------------
> Hi!
> 
> I've found that CORE::select($$$$) mishandles magical timeout values
> unless the var is used by some other means first. A minimum example
> of this:
> 
>     use Tie::Scalar;
>     tie (my $SLEEP_TIME, 'Tie::StdScalar', 0.25);
>     #print $SLEEP_TIME; # Uncomment this and select works just fine
>     select (undef, undef, undef, $SLEEP_TIME);
> 
> This blocks indefinitely rather than the quarter second sleep I
>    expect.
> 
> An example from dave_the_m shows that it isn't tie()-specific:
> 
>     "5" =~ /(\d)/;
>     #my $x = $1; # Uncomment this and select works just fine
>     select (undef, undef, undef, $1);
> 
> Note that if the commented lines are uncommented in the above
>    examples,
> select works as is should.
> 
> Original discussion found on PerlMonks: perlmonks.org/?node_id=1056913

Additional data, run on blead on Dromedary:

Both of the following work:

#########
"5" =~ /(\d)/;
my $x = $1;
select (undef, undef, undef, $1);
print "Done 1\n";
 
my $y = 5;
select (undef, undef, undef, $y);
print "Done 2\n";
#########

Thank you very much.
Jim Keenan

---
via perlbug:  queue: perl5 status: new
https://rt.perl.org:443/rt3/Ticket/Display.html?id=120102

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About