Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perlvar should mention STDIN, STDOUT, STDERR #13090

Open
p5pRT opened this issue Jul 8, 2013 · 7 comments
Open

perlvar should mention STDIN, STDOUT, STDERR #13090

p5pRT opened this issue Jul 8, 2013 · 7 comments

Comments

@p5pRT
Copy link

p5pRT commented Jul 8, 2013

Migrated from rt.perl.org#118797 (status was 'open')

Searchable as RT118797$

@p5pRT
Copy link
Author

p5pRT commented Jul 8, 2013

From @rjbs

Created by @rjbs

perlvar.pod documents ARGV and ARGVOUT but not STDOUT, STDIN, and STDERR,
nor DATA.

Even if only by cross-reference, these should be documented in perlvar.

Perl Info

Flags:
    category=docs
    severity=wishlist

Site configuration information for perl 5.19.1:

Configured by rjbs at Thu Jun 20 21:56:11 EDT 2013.

Summary of my perl5 (revision 5 version 19 subversion 1) configuration:
   
  Platform:
    osname=darwin, osvers=12.4.0, archname=darwin-2level
    uname='darwin walrus.local 12.4.0 darwin kernel version 12.4.0: wed may 1 17:57:12 pdt 2013; root:xnu-2050.24.15~1release_x86_64 x86_64 '
    config_args='-de -Dprefix=/Users/rjbs/perl5/perlbrew/perls/19.1 -Dusedevel -Aeval:scriptdir=/Users/rjbs/perl5/perlbrew/perls/19.1/bin'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include',
    optimize='-O3',
    cppflags='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include'
    ccversion='', gccversion='4.2.1 Compatible Apple Clang 4.0 ((tags/Apple/clang-421.0.57))', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -fstack-protector -L/usr/local/lib -L/opt/local/lib'
    libpth=/usr/local/lib /opt/local/lib /usr/lib
    libs=-lgdbm -ldbm -ldl -lm -lutil -lc
    perllibs=-ldl -lm -lutil -lc
    libc=, so=dylib, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -L/opt/local/lib -fstack-protector'

Locally applied patches:
    


@INC for perl 5.19.1:
    /Users/rjbs/.perlbrew/libs/19.1@std/lib/perl5/darwin-2level
    /Users/rjbs/.perlbrew/libs/19.1@std/lib/perl5
    /Users/rjbs/perl5/perlbrew/perls/19.1/lib/site_perl/5.19.1/darwin-2level
    /Users/rjbs/perl5/perlbrew/perls/19.1/lib/site_perl/5.19.1
    /Users/rjbs/perl5/perlbrew/perls/19.1/lib/5.19.1/darwin-2level
    /Users/rjbs/perl5/perlbrew/perls/19.1/lib/5.19.1
    .


Environment for perl 5.19.1:
    DYLD_LIBRARY_PATH (unset)
    HOME=/Users/rjbs
    LANG=en_US.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/Users/rjbs/.perlbrew/libs/19.1@std/bin:/Users/rjbs/perl5/perlbrew/bin:/Users/rjbs/perl5/perlbrew/perls/19.1/bin:/Users/rjbs/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/rjbs/code/hla
    PERL5LIB=/Users/rjbs/.perlbrew/libs/19.1@std/lib/perl5
    PERLBREW_BASHRC_VERSION=0.63
    PERLBREW_HOME=/Users/rjbs/.perlbrew
    PERLBREW_LIB=std
    PERLBREW_MANPATH=/Users/rjbs/.perlbrew/libs/19.1@std/man:/Users/rjbs/perl5/perlbrew/perls/19.1/man
    PERLBREW_PATH=/Users/rjbs/.perlbrew/libs/19.1@std/bin:/Users/rjbs/perl5/perlbrew/bin:/Users/rjbs/perl5/perlbrew/perls/19.1/bin
    PERLBREW_PERL=19.1
    PERLBREW_ROOT=/Users/rjbs/perl5/perlbrew
    PERLBREW_VERSION=0.63
    PERLDOC=-n/opt/local/bin/groff
    PERL_AUTOINSTALL=--skipdeps
    PERL_BADLANG (unset)
    PERL_LOCAL_LIB_ROOT=/Users/rjbs/.perlbrew/libs/19.1@std
    PERL_MAILERS=sendmail:/Users/rjbs/bin/sendmail
    PERL_MB_OPT=--install_base /Users/rjbs/.perlbrew/libs/19.1@std
    PERL_MM_OPT=INSTALL_BASE=/Users/rjbs/.perlbrew/libs/19.1@std
    SHELL=/opt/local/bin/zsh

@p5pRT
Copy link
Author

p5pRT commented Jul 8, 2013

From @ikegami

On Sun, Jul 7, 2013 at 10​:08 PM, Ricardo SIGNES
<perlbug-followup@​perl.org>wrote​:

# New Ticket Created by Ricardo SIGNES
# Please include the string​: [perl #118797]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl5/Ticket/Display.html?id=118797 >

This is a bug report for perl from rjbs@​cpan.org,
generated with the help of perlbug 1.39 running under perl 5.19.1.

-----------------------------------------------------------------
[Please describe your issue here]

perlvar.pod documents ARGV and ARGVOUT but not STDOUT, STDIN, and STDERR,
nor DATA.

Even if only by cross-reference, these should be documented in perlvar.

I tried to refer someone asking about @​ISA to perlvar, but it wasn't
listed! Is it because it's a per-package variable? If so, the same argument
applies to DATA. I'd rather see both listed.

@p5pRT
Copy link
Author

p5pRT commented Jul 8, 2013

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Jul 8, 2013

From @rjbs

Yes, if nothing else, an entry for @​ISA that cross-references would be welcome.

@p5pRT
Copy link
Author

p5pRT commented Jul 16, 2013

From @kentfredric

That might also be a good place to note that STD{IN,OUT,ERR} are
"process global", ie​: shared by all threads, which include Win32
Emulated Forks.

@p5pRT
Copy link
Author

p5pRT commented Jul 17, 2013

From @ikegami

On Tue, Jul 16, 2013 at 7​:31 PM, Kent Fredric via RT <
perlbug-followup@​perl.org> wrote​:

That might also be a good place to note that STD{IN,OUT,ERR} are
"process global", ie​: shared by all threads, which include Win32
Emulated Forks.

Interesting.

use strict;
use warnings;
use threads;
open FILE, '>', "$0.1.txt" or die $!;
async {
  open FILE, '>', "$0.2.txt" or die $!;
  print FILE "abc\n";
}->join();
print FILE "def\n";

Output​:

perl a.pl
type a.pl.1.txt
def
type a.pl.2.txt
abc

With every instance of FILE changed to STDOUT​:

perl a.pl
type a.pl.1.txt
type a.pl.2.txt
abc
def

@p5pRT
Copy link
Author

p5pRT commented Jul 20, 2013

From @kentfredric

Yeah, in my experience, this was the most surprising part of win32 IO
redirection.

You think because you can redirect IO on unix, and you can do it on
windows, that other things might work, for example, the common fork,
redirect, exec idiom.

But this little detail is the basic reason it doesn't work, and this is
why if you want to do non-blocking interactive IPC with a slave process
on Windows, most the things you'll try to use to solve that problem
won't work. ( The majority of modules that try handle this on windows
block until the slave terminates, and then map the handles back
afterwards ).

The only way I know of that lets you handle this on Win32 in real time
is this little known gem, which I try to spread awareness of where it
seems possible to do so​:

https://metacpan.org/module/Win32::Job

use Win32​::Job;
my $job = Win32​::Job->new();
$job->spawn($execpath, $stringifed_arglist, {
  stdin => $handle_for_inputstream,
  stdout => $handle_for_outputstream,
  stderr => $handle_for_stderrstream
});

And my testing demonstrates you can also do

$job->spawn($execpath, $stringifed_arglist, {
  stdin => $handle_for_inputstream,
  stdout => $foo,
  stderr => $foo
});

And the behaviour will be as expected ( try doing that without
win32​::Job ;) )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants