Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Heredoc with system call

by diotalevi (Canon)
on Dec 18, 2008 at 04:53 UTC ( #731157=note: print w/replies, xml ) Need Help??

in reply to Heredoc with system call

Are you sure you answered your own question? It looked like you wanted to pipe some data to the STDIN of the lsnrctl program (whatever that is).

PS, you should be looking at $?, not $!. $! is for system calls, not the function which happens to be called "system."

#!/usr/bin/perl -w use strict; system("lsnrctl <<\"EOF\" set password 'oracle' set current_listener 'LISTENER' status EOF ") == 0 or die "Couldn't run listener control: $?"; system($command)==0 or die "couldn't run listener control: $!";

⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

Replies are listed 'Best First'.
Re^2: Heredoc with system call
by curtisb (Monk) on Dec 18, 2008 at 05:14 UTC
    I can see what you are saying, but when I tried your code, I got this error;
    system("lsnrctl <<\"EOF\" set password oracle set current_listener LISTENER status EOF ") == 0 or die "Couldn't run listener control: $?";

    << was unexpected at this time. Couldn't run listener control: 256 at C:\ line 4.


      Oh, right. What I wrote would be valid for something like a bash shell but not for anything on Windows where it doesn't understand anything like heredocs. Since win32 perl only pretends to use fork, I found myself quickly unable to write a native CreateProcess call and then write to its stdin. I dunno. I'm just not a Windows programmer.

      ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://731157]
[stevieb]: choroba my GPS home device is done, at least prototype v1 is. I'm just making sure all of my code does what it says now
[stevieb]: I test/prototype code on my Pi, then I migrate it over to Arduino when it's ready (if that's a better platform for what I'm doing). The whole RPi stuff was for learning at first, then it snowballed. I'm just trying to get my in-house CI...
[stevieb]: ...done, which obviously requires a specific hardware setup.
[stevieb]: I don't write tests for the lower-level distributions (ie. ICs, sensors etc) within those distributions, I have all tests in a master distribution which encompasess all of the sub-modules

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2017-06-25 22:56 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (572 votes). Check out past polls.