MySQL Forums
Forum List  »  Perl

Re: capturing mysql errors with backticks
Posted by: Peter Leigh
Date: February 07, 2007 11:04AM

The error is being printed on stderr, but backticks only capture output on stdout.

You could try using:

my $var = `/usr/local/mysql/bin/mysql -u user -ppassword < load_dbs.sql 2>&1`;

which uses a shell redirect (the 2>&1 at the end) to make stderr output go to stdout instead, making it available to be picked up by your backticks.

Options: ReplyQuote


Subject
Written By
Posted
Re: capturing mysql errors with backticks
February 07, 2007 11:04AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.