in reply to Reading command output buffer
Yes it's a syntax error. In your open() statement $cmd is interpolated into a flat list before being sent to open(). So you opened a file "mysqldump" instead of a pipe. To fix this put parenthesis around $cmd.
open MYSQLDUMP, "$cmd" or die $!;
This use of open() has poor error handling as it forks a shell to run the command. If there is an error executing $cmd, it will be reported by the shell to STDERR which your script does not capture. System() is a better choice here.
Update: Open() will only fork a shell if it needs to process shell meta-characters. So, open probably ok here.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Reading command output buffer
by mhearse (Chaplain) on May 12, 2008 at 05:24 UTC |