perl-script vs cgi-script

Roland Mai <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
Hi,

I'm relatively new to perl so bear with me please. I'm seeing a strange
behavior with perl

When I use the following config in apache

<VirtualHost *:80>
  ServerName perly
  DocumentRoot /var/www/perl/perly

  <Directory /var/www/perl/perly>
    AddHandler perl-script .pl
    PerlOptions ParseHeaders
    PerlHandler ModPerl::Registry
    PerlSendHeader On
    Options Indexes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from All
  </Directory>
</VirtualHost>

The following code
#!/usr/bin/perl -w
use strict;
use warnings;
use DBI;
use Cwd;
use CGI::Pretty qw(:standard);

my %config = (
    host     => 'localhost',
    database => 'perly',
    username => 'root',
    password => ''
);

my $dbh = DBI->connect("dbi:mysql:".$config{'database'},
$config{'username'}, $config{'password'});

print header,
start_html(-title   =>  'Please Login',
            -base   =>  'true',
            -target =>  '_blank',
            -meta   =>  {'keywords'     =>  'login',
                         'description'  =>  'This is the login screen'},
            -style  =>  {'src'=>'/styles/style1.css'} );
require("/var/www/perl/perly/login.pl");
print end_html;
print "\n";

The login.pl file gets executed only once. Upon subsequent refreshes it
dissapears.
If I have AddHandler cgi-script .pl above, the script works fine.

Can someone please help me fix this issue?

Thanks,

Roland
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.