in reply to Redirection of output
Why not just re-open STDOUT such as:
in the case(s) where you need to redirect to a file?open(STDOUT,">tempfile.html",") or die $!;
If for some reason you want to preseve STDOUT you can also do the following:
use FileHandle; my $fh=new FileHandle; if ($use_a_file) { $fh=open(">tempfile.html","w") or die !: } else { $fh->fdopen(STDOUT,"w"); } print $fh "blahblahblahblah\n";
One last thought of a cautionary nature, make sure your CGI environment has permissions to open a file for writing in the directory you are attempting to do so.
I'm sure there are more ways of doing this...
| Peter L. Berghold -- Unix Professional Peter at Berghold dot Net | |
| Dog trainer, dog agility exhibitor, brewer of fine Belgian style ales. Happiness is a warm, tired, contented dog curled up at your side and a good Belgian ale in your chalice. | |
|
|---|