Skip to content

Reopening STDIN doesn't work as expected #353

@jsoref

Description

@jsoref

The content of this ticket is tested under Ubuntu 22.04 (the original problem was encountered on Ubuntu 24.04 -- GitHub runners)

ii  perl           5.34.0-3ubuntu1.3 arm64        Larry Wall's Practical Extraction and Report Language
ii  libdevel-cover-perl                1.36-2build2                            arm64        Per
/usr/local/bin/cover version 1.44

broken.pl:

close STDIN;
my $a="-world-";
open STDIN, "<", \$a;
print "before(".<>.")after\n";
$ echo unexpected | perl /tmp/broken.pl |grep before
before(-world-)after
$ echo unexpected | perl -MDevel::Cover /tmp/broken.pl |grep before
before()after

I can't claim that the code is valid, although I am using it and had hoped it'd work reliably :(.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions