Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Reading command output buffer

by starbolin (Hermit)
on May 10, 2008 at 02:21 UTC ( [id://685818]=note: print w/replies, xml ) Need Help??


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.


s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}

Replies are listed 'Best First'.
Re^2: Reading command output buffer
by mhearse (Chaplain) on May 12, 2008 at 05:24 UTC
    Thanks for the post. Problem solved. This was a weird one. It would work sometimes. Sometimes not.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://685818]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-25 22:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found