You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Vsevolod Ilyushchenko <si...@cshl.org> on 2000/09/28 18:09:55 UTC
open ">-" does not work
Hi,
Why does this script give no output under mod_perl, but works fine from the command line:
#!/usr/bin/perl -w
use CGI;
print CGI->header();
open (AAA, ">-");
print AAA "Test string";
close AAA;
The directory where the script lives is configured as:
AllowOverride None
Order allow,deny
Allow from all
SetHandler perl-script
PerlHandler Apache::PerlRun
Options +ExecCGI
Thanks,
Simon
--
_________
| x | Simon (Vsevolod ILyushchenko) simonf@cshl.org
| y = e |
|_________| http://www.simonf.com simonf@simonf.com
Disclaimer: This is not me.
This is just my mailer talking to your mailer...
Re: open ">-" does not work
Posted by Vsevolod Ilyushchenko <si...@cshl.org>.
> > Why does this script give no output under mod_perl, but works fine from the command line:
> >
> > #!/usr/bin/perl -w
> >
> > use CGI;
> >
> > print CGI->header();
> >
> > open (AAA, ">-");
>
> because the C level stdout is not hooked up to the client. you can do
> this as an alternative:
>
> if ($ENV{MOD_PERL}) {
> tie *AAA, 'Apache';
> }
> else {
> open (AAA, ">-");
> }
Doug,
Thanks, this works. However, it also gives me the following error:
Can't locate object method "FETCH" via package "Apache" at /usr/lib/perl5/site_perl/5.005/i386-linux/Apache/PerlRun.pm line 310.
Besides, what is the incantation to be able to open pipes to programs and capture their output:
open (AAA, "|some_program");
Simon
--
_________
| x | Simon (Vsevolod ILyushchenko) simonf@cshl.org
| y = e |
|_________| http://www.simonf.com simonf@simonf.com
Disclaimer: This is not me.
This is just my mailer talking to your mailer...
Re: open ">-" does not work
Posted by Doug MacEachern <do...@covalent.net>.
On Thu, 28 Sep 2000, Vsevolod Ilyushchenko wrote:
> Hi,
>
> Why does this script give no output under mod_perl, but works fine from the command line:
>
> #!/usr/bin/perl -w
>
> use CGI;
>
> print CGI->header();
>
> open (AAA, ">-");
because the C level stdout is not hooked up to the client. you can do
this as an alternative:
if ($ENV{MOD_PERL}) {
tie *AAA, 'Apache';
}
else {
open (AAA, ">-");
}