0

I am creating a Perl script in which i am using isql command to connect to the informix database . Sometime when there is a problem in query the command is getting hanged because of that script is not throwing any error or getting out of that. I am using below command to connect informix db :

`isql db <<EOF
unload to data DELIMITER ','
select* from tablename
EOF`;

How we can handle the script to quit if this command is not working , how we can check the status of the command.

5
  • Have you considered using the DBI with metacpan.org/pod/DBD::Informix? Commented Jul 12, 2018 at 14:54
  • I can't use that because my server don't have informix driver and we can't install that as well because of some restriction Commented Jul 12, 2018 at 14:59
  • I second that DBI suggestion. Commented Jul 12, 2018 at 15:10
  • Do you want to get the error thrown at stderr? Or the exit code of the command? Commented Jul 12, 2018 at 15:16
  • Exit code of the command Commented Jul 12, 2018 at 15:24

1 Answer 1

2

The best answer here is to stop doing what you're doing and get DBD::Informix installed. I know you think there's an insurmountable obstacle there, but so much of modern Perl programming is down to plumbing together useful CPAN modules that you really need to be able to install stuff from CPAN whenever you want. Whatever you need to do in order to break this logjam will be worth it in the long run.

You may be able to do what you want by looking at the value in one of Perl's error variables. I think you'll probably want $?. But note that you'll need $? >> 8 to get the actual exit code.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.