CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
suppress print statements during "do" call


New User

Nov 8, 2004, 6:52 AM

Post #1 of 3 (1084 views)
suppress print statements during "do" call Can't Post

I have a segment of code like:

do "some.cgi";

This obviously executes some.cgi, however I would like to do the following:

1) I wish to suppress whatever gets printed from some.cgi

2) Ideally, I'd like to do something like "$result = do "some.cgi"; ", but not sure if this is possible. Keep in mind, I don't want to do a system call, as there may be a large amount of tainted data I'll have to pass in at some point.

Any thoughts?




Nov 8, 2004, 11:39 AM

Post #2 of 3 (1082 views)
Re: [aj2taylo] suppress print statements during "do" call [In reply to] Can't Post

why don't you just edit the some.cgi script to not print data?

Your question is confusing to me but maybe:

$results = do 'some.cgi';
undef $results;

so you run the script but immediately delete any return data. Are you sure you shouldn't be using "require" or "use"?

New User

Nov 8, 2004, 12:07 PM

Post #3 of 3 (1078 views)
Re: [KevinR] suppress print statements during "do" call [In reply to] Can't Post


I don't want to edit some.cgi to not print because it is being used in other scenarios and removing the print will affect others. So, my script is utilizing it, but doesn't want the print statements coming through.

Also, require and use aren't useful here, because I want the script to run from beginning to end as usual, not just call certain subroutines.

Anyhow, I've found a solution - redirecting STDOUT has allowed me to suppress the print statments.




Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives