Skip to main content

All Questions

Tagged with
3 votes
1 answer
215 views

How to launch interactive commands from Perl while allowing Perl to parse the command output

The Question How do I change a Perl script to allow for both unattended and interactive execution of the child process, such that in the interactive scenario, the user interacts with the GDB just like ...
bgoodr's user avatar
  • 2,870
3 votes
1 answer
160 views

How can I detect end of file on a pipe in a Perl script?

In a Perl script, I am running another process (openssl) and communicating with it via pipes. I run openssl with IPC::Run::start. $openssl_stdin_handle = Symbol::gensym(); $openssl_stdout_handle = ...
David Levner's user avatar
1 vote
3 answers
144 views

Piping stdout to stdin in perl between multiple functions (like cmd1 | cmd2 | cmd3 in shell)

I need to process large streams of data. Streams larger than would fit in RAM. The stream needs to have multiple transformations applied to it in sequence. A pipeline of asynchronously executing tasks ...
Ole Tange's user avatar
  • 33.1k
0 votes
1 answer
216 views

Save STDIN to file in Perl?

I'm trying to use Perl to: wait until at least 1 byte arrives on STDIN read all of STDIN and save it to a file as binary (to be UTF-8 compatible) My attempts: # read STDIN into a string/buffer and ...
Zack Morris's user avatar
  • 4,783
1 vote
2 answers
236 views

command to validate input in a pipeline then pass it on?

I want to inject a command into a pipeline that just validates the input at that point, passing it on if it's valid. If it isn't valid nothing could be passed on, or perhaps a custom-defined error ...
Britton Kerin's user avatar
0 votes
1 answer
75 views

How do we use the piped command in Perl? [closed]

This is the command - $ find /var/opt/ -type f -mtime -1 -print0 | du -s |cut -f1 498172 When I run from the command line in Linux it gives output - the size. I want to run the same command from ...
p zankat's user avatar
  • 135
1 vote
1 answer
106 views

Cannot capture stdout/stderr in Perl on Windows using pipes

I'm trying to write a function that spawns a subprocess, allows us to capture stdout and stderr separately, and returns it exit status. I know there are libraries for this, but let's make it a ...
solstice333's user avatar
  • 3,583
2 votes
3 answers
886 views

How do I use Perl IPC::Run3 to read stdout and stderr from a subprocess?

I want to run a make command from a Perl script so I can capture its stdout and stderr streams. I know I could use open(MAKE, "make 2>&1 |") but this gives problems building the ...
kbro's user avatar
  • 4,871
2 votes
0 answers
292 views

Perl threads sometimes get stuck (some of them waiting for futex)

I'm facing a problem with a multi-threaded Perl application that I'm trying to run (on Redhat 7.4 using Perl 5.10.1). The problem has been reproduced through the setup below (setup is similar to the ...
rick7morty's user avatar
3 votes
2 answers
441 views

How to pipe to and read from the same tempfile handle without race conditions?

Was debugging a perl script for the first time in my life and came over this: $my_temp_file = File::Temp->tmpnam(); system("cmd $blah | cmd2 > $my_temp_file"); open(FIL, "$...
Andreas's user avatar
  • 5,269
3 votes
2 answers
175 views

How make open function use bash instead of sh?

I want to use bash instead of sh when I use the open function. For instance: sub run_cmd { my ($cmd) = @_; my $fcmd; print("Run $cmd\n"); open($fcmd, "$cmd |"); ...
Pierre's user avatar
  • 2,052
1 vote
1 answer
197 views

Perl: closing child process fails when file handle to child/pipe is aliased

I've read all the perl documentation on open, close and IPC and read a number of related forum threads, but still have been unable to figure out what I'm doing wrong. To start with I created this ...
Kyndig's user avatar
  • 11
0 votes
4 answers
117 views

Process a file containing a collection of JSON strings

(Title edited. The original title: "json content: print out parts of it as is, pipe parts of it to get human readable timestamps, output from the same command") I have a json alike content in a file: ...
Mr Janitor's user avatar
5 votes
1 answer
372 views

Does opening a pipeline in Perl involve a shell?

If I do this in a Perl script on a Unix/Linux system: open(my $fh, 'cat|'); is a shell involved? And if not, what about this: open(my $fh, 'cat -v|'); I would like to avoid a shell, if possible, ...
q.undertow's user avatar
1 vote
1 answer
189 views

Read X Number of Bytes from Pipe in Perl [closed]

What is the best way to read x number of binary bytes from a pipe in Perl? Using sysread returns only 8K bytes. I need to read around 1GB of bytes from the pipe before continuing with the rest of ...
Harry Muscle's user avatar
  • 2,335

15 30 50 per page
1
2 3 4 5
14