[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: iceweasel does not execute perl scripts



On Sun, Nov 16, 2014 at 10:17 PM, David Christensen
<dpchrist@holgerdanske.com> wrote:
> On 11/16/2014 06:20 PM, kamaraju kusumanchi wrote:
>> rajulocal@hogwarts:~/public_html/perl$ cat mod_perl_rules1.pl
>> print "Content-type: text/plain\n\n";
>> print "mod_perl rules!\n";
>
> ...
>>
>> However, if I point the iceweasel brower to
>> http://localhost/~rajulocal/perl/mod_perl_rules1.pl , it launches the
>> file download dialog
>
>
> That is not a valid mod_perl program, and Apache requires additional
> configuration to know what URL's are to be passed to mod_perl.  For all
> things mod_perl, please see:
>
>     http://perl.apache.org/

Thanks for pointing out that Apache requires additional configuration.

I initially looked at
http://perl.apache.org/docs/2.0/user/intro/start_fast.html before
posting to the list. But it was difficult to follow since the website
tries to configure it differently than what seems to be Debian's way
of configuring things.

For example, it asks to add the following to httpd.conf
  LoadModule perl_module modules/mod_perl.so

But there is no httpd.conf in Debian. Instead I found this in Debian

root@hogwarts:/etc/apache2/mods-enabled# cat perl.load
LoadModule perl_module /usr/lib/apache2/modules/mod_perl.so

It talks about "Registry Scripts" without first telling what is
actually meant by a registry script. So it was all confusing to me.

> Without seeing your Apache configuration, it may or may not be a valid Perl
> CGI script.  Have you set the execute bit on the file?

I finally got it working through some trial and error. Here is my
configuration file

root@hogwarts:/etc/apache2/mods-enabled# cat perl.conf
<IfModule mod_perl.c>
        Alias /perl/ /home/rajulocal/public_html/perl/
        <Location /perl>
                SetHandler perl-script
                PerlResponseHandler ModPerl::Registry
                PerlOptions +ParseHeaders
                Options +ExecCGI
                Order allow,deny
                Allow from all
        </Location>
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

root@hogwarts:/etc/apache2/mods-enabled# ls -al perl.conf
-rw-r--r-- 1 root root 308 Nov 17 00:19 perl.conf

It is interesting that for other modules (ex:- userdir) Debian
supplies userdir.load, userdir.conf files . But for the mod_perl,
Debian only supplies that perl.load file.

Another issue was that, in the browser I was pointing to
http://localhost/~rajulocal/perl/mod_perl_rules1.pl which opens up the
download dialog. But instead, I should point it to
http://localhost/perl/mod_perl_rules1.pl which works fine. I realized
that this is due to the Alias directive. But no where in the docs
http://perl.apache.org/docs/2.0/user/config/config.html , this
directive is explained. Instead one is expected to refer to the docs
of old version ( http://perl.apache.org/docs/1.0/guide/config.html )
where these things are explained.

In the hindsight, all this looks pretty obvious. But it took me a long
time to figure it all out.

> Note that PSGI/ Plack is a newer way to run Perl programs inside a web
> server (Apache, nginx, and others):
>
>     http://plackperl.org/

Ultimately, what I want to do is a very simple thing. May be I am
using the wrong tools here and making it more complicated than it
actually should be. Please point me in the right direction if this is
the case.

I have a perl script that takes a bunch of input parameters and spits
some output. I wanted to write a web interface for it where I get the
input from the user via "HTML forms" and pass it to the perl script,
then run it and show the output. Should I use javascript for this sort
of thing? If so, where does it fit in? Any pointers to good
documentation are appreciated.

thanks
raju
--
Kamaraju S Kusumanchi
http://malayamaarutham.blogspot.com/


Reply to: