in reply to Using STDIN with IO::CaptureOutput
cat file.sql | sql database -uUsername -Ppassword
or the cheaper
sql database -uUsername -Ppassword <file.sql
are shell commands. You need a shell to execute them.
my $shell_cmd = 'sql database -uUsername -Ppassword <file.sql'; capture_exec_combined('sh', '-c', $shell_cmd)
If you pass a single argument to capture_exec_combined, it might implicitly invoke a shell (like system does). If so, the following would suffice:
my $shell_cmd = 'sql database -uUsername -Ppassword <file.sql'; capture_exec_combined($shell_cmd)
|
|---|