Ask a Question related to PERL Beginners, Design and Development.

  1. #1

    Default Bidirectional pipes

    Hi all,
    I wonder how can I open pipe to STDIN and STDOUT of a process ?

    Tnx.
    Mehmet


    Mehmet Ekici Guest

  2. Similar Questions and Discussions

    1. BiDirectional Sorting
      Hi, I have a datagrid, which gets populated using a Stored Procedure I am using the standard sort comman Sub dg_SortCommand(ByVal source As...
    2. get rid of whitespace around pipes??
      On Dec 17, LoneWolf said: Then split on /\s*\|\s*/. That regex reads "zero or more whitespace, a |, then zero or more whitespace". @fields...
    3. How do I set up bidirectional pipes over a network connection?
      I have 2 Linux boxes I want to talk to each other over the local network using a Perl script. Is it possible to set up a bidirectional pipe so...
    4. How do I set up bidirectional pipes over a network connection ?
      Dan Anderson wrote: You're talking about a TCP connection, which is bidirectional. You might look at the standard rdist(1) utility for this...
    5. bi-directional IPC / pipes / when to close??
      Hi, I'm writing a C program that needs to bi-directionally communicate with with a forked/execvp'd process. Here is a sample program that...
  3. #2

    Default Re: Bidirectional pipes


    Hello,
    I tried it to use with sqplus username/passwd

    after this I like to send some sql commands and get their results but
    at some point system blocks and I don't get anything

    $ph = open2 (\*Reader , \*Writer, "sqlplus xxx/yyy");

    print Writer , "desc user_tables;\n";
    while (<Reader>)
    {
    print ;
    }

    ..... (it hang somewhere here )
    print Writer , "desc dba_tables;\n";
    while (<Reader>)
    {
    print ;
    }








    Sudarshan Raghavan
    <sraghava@kyocera-wi To: [email]beginners@perl.org[/email]
    reless.com> cc:
    Subject: Re: Bidirectional pipes
    09/02/2003 11:21 AM






    [email]Mehmet.Ekici@alcatel.com.tr[/email] wrote:
    >Hi all,
    >I wonder how can I open pipe to STDIN and STDOUT of a process ?
    >
    perldoc IPC::Open2

    If you need a handle to STDERR
    perldoc IPC::Open3
    >
    >Tnx.
    >Mehmet
    >
    >
    >
    >
    >

    --
    To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    For additional commands, e-mail: [email]beginners-help@perl.org[/email]






    Mehmet Ekici Guest

  4. #3

    Default Re: Bidirectional pipes



    [email]Mehmet.Ekici@alcatel.com.tr[/email] wrote:
    >Hello,
    >I tried it to use with sqplus username/passwd
    >
    >after this I like to send some sql commands and get their results but
    >at some point system blocks and I don't get anything
    >
    >$ph = open2 (\*Reader , \*Writer, "sqlplus xxx/yyy");
    >
    >print Writer , "desc user_tables;\n";
    >while (<Reader>)
    >{
    > print ;
    >}
    >
    >.... (it hang somewhere here )
    >
    The IPC::Open2 manpage mentions a warning on similar lines. I am not
    entirely sure about using this module with sqlplus and any associated
    caveats, you might want to google on this topic. I guess you are using
    an oracle database, why not use DBI for this purpose. You will
    interested in these modules
    DBI (perldoc DBI)
    DBD::Oracle (hope I got the name right. perldoc DBD::Oracle, you can
    download and install this module from [url]http://search.cpan.org[/url])
    >print Writer , "desc dba_tables;\n";
    >while (<Reader>)
    >{
    > print ;
    >}
    >
    >
    >
    >
    >
    >
    >
    >
    > Sudarshan Raghavan
    > <sraghava@kyocera-wi To: [email]beginners@perl.org[/email]
    > reless.com> cc:
    > Subject: Re: Bidirectional pipes
    > 09/02/2003 11:21 AM
    >
    >
    >
    >
    >
    >
    >Mehmet.Ekici@alcatel.com.tr wrote:
    >
    >
    >
    >>Hi all,
    >>I wonder how can I open pipe to STDIN and STDOUT of a process ?
    >>
    >>
    >>
    >
    >perldoc IPC::Open2
    >
    >If you need a handle to STDERR
    >perldoc IPC::Open3
    >
    >
    >
    >>Tnx.
    >>Mehmet
    >>
    >>
    >>
    >>
    >>
    >>
    >>
    >
    >
    >--
    >To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    >For additional commands, e-mail: [email]beginners-help@perl.org[/email]
    >
    >
    >
    >
    >
    >
    >
    >
    >
    Sudarshan Raghavan Guest

  5. #4

    Default Re: Bidirectional pipes


    Hi,
    I have already using DBI module, I just wanted to explain with an example.
    Let think that I want to be root user and issue some command in that case I
    also need
    bidirectional pipes.

    su - root
    Password ....

    execute some commands here .

    Mehmet



    Sudarshan Raghavan
    <sraghava@kyocera-wi To: [email]beginners@perl.org[/email]
    reless.com> cc:
    Subject: Re: Bidirectional pipes
    09/02/2003 02:27 PM








    [email]Mehmet.Ekici@alcatel.com.tr[/email] wrote:
    >Hello,
    >I tried it to use with sqplus username/passwd
    >
    >after this I like to send some sql commands and get their results but
    >at some point system blocks and I don't get anything
    >
    >$ph = open2 (\*Reader , \*Writer, "sqlplus xxx/yyy");
    >
    >print Writer , "desc user_tables;\n";
    >while (<Reader>)
    >{
    > print ;
    >}
    >
    >.... (it hang somewhere here )
    >
    The IPC::Open2 manpage mentions a warning on similar lines. I am not
    entirely sure about using this module with sqlplus and any associated
    caveats, you might want to google on this topic. I guess you are using
    an oracle database, why not use DBI for this purpose. You will
    interested in these modules
    DBI (perldoc DBI)
    DBD::Oracle (hope I got the name right. perldoc DBD::Oracle, you can
    download and install this module from [url]http://search.cpan.org[/url])
    >print Writer , "desc dba_tables;\n";
    >while (<Reader>)
    >{
    > print ;
    >}
    >
    >
    >
    >
    >
    >
    >
    >
    > Sudarshan Raghavan
    > <sraghava@kyocera-wi To:
    [email]beginners@perl.org[/email]
    > reless.com> cc:
    > Subject: Re:
    Bidirectional pipes
    > 09/02/2003 11:21 AM
    >
    >
    >
    >
    >
    >
    >Mehmet.Ekici@alcatel.com.tr wrote:
    >
    >
    >
    >>Hi all,
    >>I wonder how can I open pipe to STDIN and STDOUT of a process ?
    >>
    >>
    >>
    >
    >perldoc IPC::Open2
    >
    >If you need a handle to STDERR
    >perldoc IPC::Open3
    >
    >
    >
    >>Tnx.
    >>Mehmet
    >>
    >>
    >>
    >>
    >>
    >>
    >>
    >
    >
    >--
    >To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    >For additional commands, e-mail: [email]beginners-help@perl.org[/email]
    >
    >
    >
    >
    >
    >
    >
    >
    >

    --
    To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    For additional commands, e-mail: [email]beginners-help@perl.org[/email]






    Mehmet Ekici Guest

  6. #5

    Post Re: Bidirectional pipes

    Quote Originally Posted by Mehmet Ekici View Post
    Hi all,
    I wonder how can I open pipe to STDIN and STDOUT of a process ?

    Tnx.
    Mehmet
    use FileHandle;
    use IPC::Open2;
    $pid = open2(*Reader, *Writer, "cat -u -n" );
    print Writer "stuff\n";
    $got = <Reader>;
    Ruslan Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139