blahblahblah has asked for the wisdom of the Perl Monks concerning the following question:
Anyone know of a different way I could print to STDOUT as the script is finishing, or get STDOUT working in the cleanup code?
The script below is a simple example of what I'm talking about. "finishing stdout." never gets printed. The commented out lines didn't help.
#!/usr/local/bin/perl print "Content-type: text/plain\n\n(in main code)\n"; # my $old; # open ($old, ">&STDOUT") or die "Can't dup STDOUT: $!"; my $r = Apache->request; $r->pool->cleanup_register(\&finish); sub finish { print STDERR "finishing...\n"; # open (STDOUT, ">&", $old) or die "Can't dup \$old: $!"; print "finishing stdout.\n"; print STDERR "finished.\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Can I print to STDOUT in mod_perl cleanup_register code?
by ikegami (Patriarch) on Sep 30, 2004 at 20:41 UTC |