You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Sam Wilkins <go...@internet.look.ca> on 2004/10/02 03:13:50 UTC
100% failure on the most basic scripts
#!/usr/bin/perl -w
use strict;
print "Content-type: text/html\r\n\r\n";
print "It worked!!!\n";
No matter what I run, even that, I get document contains no data. It
works from the command line. If it helps, I'm on Mac OS X 10.3.5,
Apache 1.3.29, and I don't know how to determine my mod_perl version.
<Location /perl>
SetHandler perl-script
PerlHandler Apache::Registry
Options ExecCGI
PerlSendHeader Off
allow from all
</Location>
That is what I have at the end of my httpd.conf. Right now, that's
really all I can think of to give you guys. If you can think of
something else that might be helpful, let me know and I'll try to get
it.
PerlEx and mod_perl
Posted by gunther <gu...@extropia.com>.
I apologize if this has been posted here before, but I don't recall
seeing it.
The ActiveState guys recently posted that they are stopping all
development (although support will continue through March 2005) on PerlEx.
http://www.activestate.com/Products/PerlEx/
For those that are not aware, PerlEx is very similar to mod_perl and
even uses a modified version of Apache::Registry to manage scripts run
through it. I mention this news in case anyone who has experience in
mod_perl and Windows versions of Perl is interested in helping the newly
orphaned come over to the mod_perl side as a natural, eventual course of
migration.
>
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: 100% failure on the most basic scripts
Posted by Sam Wilkins <go...@internet.look.ca>.
On Oct 1, 2004, at 10:14 PM, Markus Wichitill wrote:
> Sam Wilkins wrote:
>> #!/usr/bin/perl -w
>> use strict;
>> print "Content-type: text/html\r\n\r\n";
>> print "It worked!!!\n";
>> No matter what I run, even that, I get document contains no data. It
>> works from the command line. If it helps, I'm on Mac OS X 10.3.5,
>> Apache 1.3.29, and I don't know how to determine my mod_perl version.
>> <Location /perl>
>> SetHandler perl-script
>> PerlHandler Apache::Registry
>> Options ExecCGI
>> PerlSendHeader Off
>> allow from all
>> </Location>
>
> If you don't send full HTTP headers yourself, you need to set
> "PerlSendHeader On" to make Apache parse and complete the headers.
Actually, I tried it with it on before, and I just turned it on now,
and no luck.
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: 100% failure on the most basic scripts
Posted by Markus Wichitill <ma...@gmx.de>.
Sam Wilkins wrote:
> #!/usr/bin/perl -w
> use strict;
> print "Content-type: text/html\r\n\r\n";
> print "It worked!!!\n";
>
> No matter what I run, even that, I get document contains no data. It
> works from the command line. If it helps, I'm on Mac OS X 10.3.5, Apache
> 1.3.29, and I don't know how to determine my mod_perl version.
>
> <Location /perl>
> SetHandler perl-script
> PerlHandler Apache::Registry
> Options ExecCGI
> PerlSendHeader Off
> allow from all
> </Location>
If you don't send full HTTP headers yourself, you need to set
"PerlSendHeader On" to make Apache parse and complete the headers.
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: 100% failure on the most basic scripts
Posted by Sam Wilkins <go...@internet.look.ca>.
On Saturday, October 2, 2004, at 12:57 PM, Charlie Garrison wrote:
> The only one I can see which looks like a possible offender is
> HTML::Template. The $args{print_to} is previously set to *STDOUT. If I
> get a chance I'll setup a test config which doesn't use HTML::Template
> and see of the problem goes away. Maybe Sam Wilkins can let us know
> whether he is also using HTML::Template.
I have no idea whether I am or not. If it's the default, I most likely
am though.
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: 100% failure on the most basic scripts
Posted by Charlie Garrison <ga...@zeta.org.au>.
Good morning,
On 2/10/04 at 10:46 AM -0400, Stas Bekman <st...@stason.org> wrote:
>> This is a common problem with mod_perl and OSX. Add the following to your
>> httpd.conf file:
>>
>> # fix for mod_perl print()
>> PerlHeaderParserHandler "sub { tie *STDOUT, 'Apache' unless tied *STDOUT; }"
>>
>> I don't understand why the problem exists or why this fixes it. I
>> took the advice (found it via some Google searching) and mod_perl
>> scripts now work for me.
>
>Most likely some core module untie's/re-tie's STDOUT after mod_perl had it
>tied. I'd love to have the guilty party discovered. It's have been easy if
>tie was overridable via CORE::GLOBAL::tie but it doesn't seem the case. So
>you probably need to set breakpoints at tie and untie to see which module
>messes with that.
That makes sense; thanks for the explanation. I don't particularly like
the perl command line debugger, especially when debugging mod_perl
scripts. So I thought a search through my perl lib for "tie " might
reveal the culprit. This is what I found:
$ grep -r 'tie ' /Library/Perl/5.8.1
/Library/Perl/5.8.1/darwin-thread-multi-2level/DBD/DBM.pm: eval { tie %h, $tie_class, @tie_args };
/Library/Perl/5.8.1/darwin-thread-multi-2level/DBD/DBM.pm: untie %{$self->{hash}} if $self->{hash};
/Library/Perl/5.8.1/darwin-thread-multi-2level/DBD/DBM.pm: untie %{$self->{hash}} if $self->{hash};
/Library/Perl/5.8.1/darwin-thread-multi-2level/DBI/DBD.pm:Because you have the inner handle, tie magic doesn't get invoked
/Library/Perl/5.8.1/darwin-thread-multi-2level/DBI/PurePerl.pm: untie $DBI::err;
/Library/Perl/5.8.1/darwin-thread-multi-2level/DBI/PurePerl.pm: untie $DBI::errstr;
/Library/Perl/5.8.1/darwin-thread-multi-2level/DBI/PurePerl.pm: untie $DBI::state;
/Library/Perl/5.8.1/darwin-thread-multi-2level/DBI/PurePerl.pm: untie $DBI::rows;
/Library/Perl/5.8.1/darwin-thread-multi-2level/DBI/PurePerl.pm: #tie $DBI::lasth, 'DBI::var', '!lasth'; # special case: return boolean
/Library/Perl/5.8.1/darwin-thread-multi-2level/DBI.pm:tie $DBI::err, 'DBI::var', '*err'; # special case: referenced via IHA list
/Library/Perl/5.8.1/darwin-thread-multi-2level/DBI.pm:tie $DBI::state, 'DBI::var', '"state'; # special case: referenced via IHA list
/Library/Perl/5.8.1/darwin-thread-multi-2level/DBI.pm:tie $DBI::lasth, 'DBI::var', '!lasth'; # special case: return boolean
/Library/Perl/5.8.1/darwin-thread-multi-2level/DBI.pm:tie $DBI::errstr, 'DBI::var', '&errstr'; # call &errstr in last used pkg
/Library/Perl/5.8.1/darwin-thread-multi-2level/DBI.pm:tie $DBI::rows, 'DBI::var', '&rows'; # call &rows in last used pkg
/Library/Perl/5.8.1/darwin-thread-multi-2level/DBI.pm:tie %DBI::DBI => 'DBI::DBI_tie';
/Library/Perl/5.8.1/darwin-thread-multi-2level/DBI.pm: $i = tie %hash, $class, $attr; # ref to inner hash (for driver)
/Library/Perl/5.8.1/darwin-thread-multi-2level/DBI.pm: # The above tie and bless may migrate down into _setup_handle()...
/Library/Perl/5.8.1/darwin-thread-multi-2level/DBI.pm:Because of the way the Perl tie mechanism works you cannot reliably
/Library/Perl/5.8.1/HTML/Template.pm: tie %cache, 'IPC::SharedCache',
/Library/Perl/5.8.1/HTML/Template.pm: # the shared cache tie hold references to $self! This was not easy
/Library/Perl/5.8.1/HTML/Template.pm: tie $result, 'HTML::Template::PRINTSCALAR', $args{print_to}
/Library/Perl/5.8.1/IO/Zlib.pm: tie *FILE, 'IO::Zlib', "file.gz", "wb";
/Library/Perl/5.8.1/IO/Zlib.pm: tie *FILE, 'IO::Zlib', "file.gz", "rb";
/Library/Perl/5.8.1/IO/Zlib.pm: tie *{$self}, $class, @args;
/Library/Perl/5.8.1/Term/ReadLine/Perl.pm:tie %attribs, 'Term::ReadLine::Perl::Tie' or die ;
/Library/Perl/5.8.1/WWW/RobotRules/AnyDBM_File.pm: tie %{$self->{'dbm'}}, 'AnyDBM_File', $file, O_CREAT|O_RDWR, 0640
/Library/Perl/5.8.1/WWW/RobotRules/AnyDBM_File.pm: untie %{$self->{'dbm'}};
/Library/Perl/5.8.1/WWW/RobotRules/AnyDBM_File.pm: tie %{$self->{'dbm'}}, 'AnyDBM_File', $file, O_TRUNC|O_RDWR, 0640;
The only one I can see which looks like a possible offender is
HTML::Template. The $args{print_to} is previously set to *STDOUT. If I
get a chance I'll setup a test config which doesn't use HTML::Template
and see of the problem goes away. Maybe Sam Wilkins can let us know
whether he is also using HTML::Template.
Charlie
--
Charlie Garrison <ga...@zeta.org.au>
PO Box 141, Windsor, NSW 2756, Australia
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: 100% failure on the most basic scripts
Posted by Stas Bekman <st...@stason.org>.
Charlie Garrison wrote:
> Good evening,
>
> On 1/10/04 at 9:13 PM -0400, Sam Wilkins <go...@internet.look.ca> wrote:
>
>
>>No matter what I run, even that, I get document contains no data. It
>>works from the command line. If it helps, I'm on Mac OS X 10.3.5,
>>Apache 1.3.29, and I don't know how to determine my mod_perl version.
>
>
> This is a common problem with mod_perl and OSX. Add the following to your
> httpd.conf file:
>
> # fix for mod_perl print()
> PerlHeaderParserHandler "sub { tie *STDOUT, 'Apache' unless tied *STDOUT; }"
>
> I don't understand why the problem exists or why this fixes it. I took the
> advice (found it via some Google searching) and mod_perl scripts now work for
> me.
Most likely some core module untie's/re-tie's STDOUT after mod_perl had it
tied. I'd love to have the guilty party discovered. It's have been easy if
tie was overridable via CORE::GLOBAL::tie but it doesn't seem the case. So
you probably need to set breakpoints at tie and untie to see which module
messes with that.
Another solution is to use $r->print() instead of print() (use
Apache->request to get $r if you don't have it already).
But in any case I'll add your workaround to the troubleshooting section.
Thanks for posting it, Charlie.
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: 100% failure on the most basic scripts
Posted by Sam Wilkins <go...@internet.look.ca>.
On Saturday, October 2, 2004, at 09:49 AM, Charlie Garrison wrote:
> Good evening,
>
> On 1/10/04 at 9:13 PM -0400, Sam Wilkins <go...@internet.look.ca>
> wrote:
>
>> No matter what I run, even that, I get document contains no data. It
>> works from the command line. If it helps, I'm on Mac OS X 10.3.5,
>> Apache 1.3.29, and I don't know how to determine my mod_perl version.
>
> This is a common problem with mod_perl and OSX. Add the following to
> your
> httpd.conf file:
>
> # fix for mod_perl print()
> PerlHeaderParserHandler "sub { tie *STDOUT, 'Apache' unless tied
> *STDOUT; }"
Thanks, I've decided to make a little configuration change. How do I
set Apache to only pass files that end in .pl to modperl?
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: 100% failure on the most basic scripts
Posted by Charlie Garrison <ga...@zeta.org.au>.
Good evening,
On 1/10/04 at 9:13 PM -0400, Sam Wilkins <go...@internet.look.ca> wrote:
>No matter what I run, even that, I get document contains no data. It
>works from the command line. If it helps, I'm on Mac OS X 10.3.5,
>Apache 1.3.29, and I don't know how to determine my mod_perl version.
This is a common problem with mod_perl and OSX. Add the following to your
httpd.conf file:
# fix for mod_perl print()
PerlHeaderParserHandler "sub { tie *STDOUT, 'Apache' unless tied *STDOUT; }"
I don't understand why the problem exists or why this fixes it. I took the
advice (found it via some Google searching) and mod_perl scripts now work for
me.
Charlie
--
Charlie Garrison <ga...@zeta.org.au>
PO Box 141, Windsor, NSW 2756, Australia
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html