perl-script vs cgi-script

2010-08-01 Thread Roland Mai
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


  ServerName perly
  DocumentRoot /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
  


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


Re: perl-script vs cgi-script

2010-08-01 Thread Randal L. Schwartz
> "Roland" == Roland Mai  writes:

Roland> The login.pl file gets executed only once. Upon subsequent refreshes it
Roland> dissapears.

What does that mean?  Does it generate content?  Are there any errors in
the error log?  Can you log that it is being actually invoked?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


Re: perl-script vs cgi-script

2010-08-01 Thread Roland Mai
Well, Anthony Esposito replied to me personally explaining that the files
get compiled once, I suppose to speed things up. So, the login.pl gets
rendered only once (when it's compiled), but not thereafter. The solution is
to turn the stuff in login.pl into a method and invoke it later.

On Sun, Aug 1, 2010 at 9:49 PM, Randal L. Schwartz wrote:

> > "Roland" == Roland Mai  writes:
>
> Roland> The login.pl file gets executed only once. Upon subsequent
> refreshes it
> Roland> dissapears.
>
> What does that mean?  Does it generate content?  Are there any errors in
> the error log?  Can you log that it is being actually invoked?
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
>  http://www.stonehenge.com/merlyn/>
> Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
> See http://methodsandmessages.vox.com/ for Smalltalk and Seaside
> discussion
>