Computer Science Canada ActivePerl -- getting output of external programs |
Author: | rizzix [ Sun Nov 30, 2003 5:22 pm ] |
Post subject: | ActivePerl -- getting output of external programs |
ok this is really annoying.. i can't get any output from any program i execute through a perl script using acitve perl.. have u guys tried this.. if u were successful.. how did u do it? note: everytime i tried doing this, the program i executed always prints to the console. how annoying! And the variable to which i'm storing the output to, is empty! ![]() ![]() ![]() |
Author: | octopi [ Mon Dec 01, 2003 10:24 pm ] |
Post subject: | |
what code are you using to run the command? most things will return the return value of the program. $theoutput = `echo hello`; should = "hello" |
Author: | rizzix [ Wed Dec 03, 2003 1:56 am ] |
Post subject: | |
hmm, odd, echo appears to works. so does ipconfig.exe javac does not work.. i guess perl (or maybe jsut ActivePerl) can't catch output from a java program? |
Author: | octopi [ Wed Dec 03, 2003 9:55 am ] |
Post subject: | |
it could be a STDERR, STDOUT problem. Try redirecting STDERR to STDOUT, and see if that helps (add this to the end of your command '2>&1' pretty sure thats it, and I'm pretty sure this works in 'nix, and windows) |
Author: | rizzix [ Wed Dec 03, 2003 4:09 pm ] |
Post subject: | |
woot thanks .. works.. |