Re: STDOUT oddity

2001-01-22 Thread Chris Atenasio


Hi again.  Joel Mello promptly pointed out the solution (passing by
reference):

> filter_template(\*TEMP, \*STDOUT, %rep);

No more replies necessary, thanks.

- Chris

Chris Atenasio <[EMAIL PROTECTED]> - Friends don't let friends use Windows.
Send mail subject "send pgp key" or "word of the day" for auto-response.
Today's word of the day: ownerships



STDOUT oddity

2001-01-22 Thread Chris Atenasio


Hello,

Writing a little webboard cgi to more familiarize myself with mod_perl
and mysql, I've run into a little quirk that I can't quite figure out.
The following code:


sub filter_template
{
my ($in, $out, %rep) = @_;

while(<$in>)
{
while(//$rep{$1}/;
}
print $out $_;
}
}

...

local *TEMP

...

filter_template(*TEMP, *STDOUT, %rep);


Works fine if I load the script as a normal CGI, but not at all when
run through mod_perl.  A little playing games showed that the "print
$out $_" was the failing point.  Changing it to "print $_" in fact
works fine (but is not what the function is supposed to do!)

I thought apache ties STDIN and STDOUT appropriately... Or am I
handling file handles incorrectly?

Thanks

- Chris

Chris Atenasio <[EMAIL PROTECTED]> - Friends don't let friends use Windows.
Send mail subject "send pgp key" or "word of the day" for auto-response.
Today's word of the day: ownerships