Okay here's a demonstration:

The test script is:

#!/usr/local/bin/perl

use strict;
use vars qw ($mydata);

$mydata = 'woodooeer';
my $data = '';
my $data2 = 'dingdong';

print "Content-type: text/plain\n\n";

print scalar localtime () , "\n\n";
print `cat /tmp/modperltest.txt`;

END
{
        open FILE , '>/tmp/modperltest.txt';
        print FILE "DATA: " , scalar localtime , "\n";
        print FILE "$data\n";
        print FILE "$mydata\n";
        print FILE "$data2\n";
        close FILE;
}


You can see the different behaviors at:
no modperl: http://www.nasim.org/test/short.cgi
modperl: http://www.nasim.org/test/short.pl

Note that the file is printed first and then updated. Hit refresh
to see that modperl misses $mydata.

Regards,

Faisal



At 01:12 AM 11/27/2004, Faisal Nasim wrote:
Hi,

I have an END block in my Apache::PerlRun script. First I was trying to print something
in the END{} block and it didn't show up on the browser. I tried writing to a file and it
worked great! The weird thing is that when I try to use Dumper() call or any other
module it doesn't work, it bails out. No 500, nothing in logs but it seems that I can
no longer use any 'use'd modules. I tried accessing a variable which I was using
through use vars() and it wasn't available in END {} either. Any ideas what I'm doing
wrong? Global my() variables are available in the end block only. I looked through the guide
and mailing list archives, no avail. I'm doing  modperl 1.29 on Apache 1.3.33. Simple
Apache::PerlRun, no extra modules, no special configuration directives.

Thank you.

Regards,

Faisal

Reply via email to