Where is the standard output coming from in the following program

Discussion in 'Perl Misc' started by grocery_stocker, Feb 23, 2009.

  1. Given the following...

    m-net% more bbs.pl
    #!/usr/bin/perl

    use strict;
    use warnings;

    open my $out, '|-', 'bbs' or die "cannot open pipe to bbs";

    print $out "find nope a=cdalten\n";

    close $out or die "cannot close pipe to bbs: $!";

    it produces....

    m-net% ./bbs.pl
    YAPP 3.1.1 Copyright (c)1995 Armidale Software
    Registered to: Arbornet

    Welcome to the
    February General Conference


    fairwitness: jerryr

    41 newresponse items and 9 brandnew items
    First item 1, last 80
    No matches found.

    Now leaving February General...
    m-net%


    The question is, where is the standard output coming from? The child
    process?
     
    grocery_stocker, Feb 23, 2009
    #1
    1. Advertising

  2. grocery_stocker

    Tim Greer Guest

    grocery_stocker wrote:

    > open my $out, '|-', 'bbs' or die "cannot open pipe to bbs";
    >
    > print $out "find nope a=cdalten\n";


    Going by that code, you've sent the command to (and get the output from)
    the child process.
    --
    Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
    Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
    and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
    Industry's most experienced staff! -- Web Hosting With Muscle!
     
    Tim Greer, Feb 24, 2009
    #2
    1. Advertising

  3. grocery_stocker

    Tim Greer Guest

    Tim Greer wrote:

    > grocery_stocker wrote:
    >
    >> open my $out, '|-', 'bbs' or die "cannot open pipe to bbs";
    >>
    >> print $out "find nope a=cdalten\n";

    >
    > Going by that code, you've sent the command to (and get the output
    > from) the child process.


    Pardon, I worded that poorly. Greg's explanation of the child process
    inheriting the output from the parent process is a better way of
    wording it (my reply makes it sound like it is inherited by the parent
    from the child -- bad wording... oops).
    --
    Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
    Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
    and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
    Industry's most experienced staff! -- Web Hosting With Muscle!
     
    Tim Greer, Feb 24, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve Holden

    PyCon is Coming! PyCon is Coming!

    Steve Holden, Jan 5, 2006, in forum: Python
    Replies:
    0
    Views:
    332
    Steve Holden
    Jan 5, 2006
  2. Replies:
    1
    Views:
    513
    alessandro basili
    Sep 21, 2006
  3. Tazz

    weird program coming on

    Tazz, Jun 6, 2008, in forum: ASP .Net
    Replies:
    0
    Views:
    967
  4. Venks
    Replies:
    5
    Views:
    277
    Ken Bloom
    Dec 6, 2007
  5. Avnesh Shakya

    Output is not coming with defined color

    Avnesh Shakya, May 29, 2013, in forum: Python
    Replies:
    2
    Views:
    84
Loading...

Share This Page