Re: END block weird behavior
[prev]
[thread]
[next]
[Date index for 2004/12/02]
--=====================_227285703==.ALT
Content-Type: text/plain; charset="us-ascii"
At 05:48 AM 12/2/2004, Stas Bekman wrote:
>Faisal Nasim wrote:
>>Okay here's a demonstration:
>>The test script is:
>>#!/usr/local/bin/perl
>>use strict;
>>use vars qw ($mydata);
>>$mydata = 'woodooeer';
>>my $data = 'woodoo';
>>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.
>
>Actually it's very inconsistent. If I hit reload I get the value of $mydata appearing and disappearing in both scripts.
>
>Any chance you could rewrite your code not to use the END block for the desired functionality? At least until we get some freed resources to work on modperl1 issues again?
It is not inconsistent. Note that the file is printed first before its rewritten.
So, when you load the mod_cgi page after mod_perl, you'll still see
a missing element. Hit refresh and you can see it worked great. Not
using END block solved all the problems but if I press STOP while
a processing is being done (takes 2-3 secs), it doesn't call the cleanup
routine and that sometimes leaves the file locks open. I was hoping I
could always perform final cleanup in my END block. I can take a crack
at the source, I've done Apache hacking before.
Regards,
Faisal
--=====================_227285703==.ALT
Content-Type: text/html; charset="us-ascii"
<html>
<body>
<font size=3>At 05:48 AM 12/2/2004, Stas Bekman wrote:<br>
<blockquote type=cite class=cite cite="">Faisal Nasim wrote:<br>
<blockquote type=cite class=cite cite="">Okay here's a
demonstration:<br>
The test script is:<br>
#!/usr/local/bin/perl<br>
use strict;<br>
use vars qw ($mydata);<br>
$mydata = 'woodooeer';<br>
my $data = 'woodoo';<br>
my $data2 = 'dingdong';<br>
print "Content-type: text/plain\n\n";<br>
print scalar localtime () , "\n\n";<br>
print `cat /tmp/modperltest.txt`;<br>
END<br>
{<br>
open FILE ,
'>/tmp/modperltest.txt';<br>
print FILE "DATA: "
, scalar localtime , "\n";<br>
print FILE
"$data\n";<br>
print FILE
"$mydata\n";<br>
print FILE
"$data2\n";<br>
close FILE;<br>
}<br><br>
You can see the different behaviors at:<br>
no modperl:
<a href="http://www.nasim.org/test/short.cgi" eudora="autourl">http://www.nasim.org/test/short.cgi</a><br>
modperl:
<a href="http://www.nasim.org/test/short.pl" eudora="autourl">http://www.nasim.org/test/short.pl</a><br>
Note that the file is printed first and then updated. Hit refresh<br>
to see that modperl misses $mydata.</blockquote><br>
Actually it's very inconsistent. If I hit reload I get the value of
$mydata appearing and disappearing in both scripts.<br><br>
Any chance you could rewrite your code not to use the END block for the
desired functionality? At least until we get some freed resources to work
on modperl1 issues again?</blockquote><br>
It is not inconsistent. Note that the file is printed first before its
rewritten.<br>
So, when you load the mod_cgi page after mod_perl, you'll still see<br>
a missing element. Hit refresh and you can see it worked great. Not<br>
using END block solved all the problems but if I press STOP while<br>
a processing is being done (takes 2-3 secs), it doesn't call the
cleanup<br>
routine and that sometimes leaves the file locks open. I was hoping
I<br>
could always perform final cleanup in my END block. I can take a
crack<br>
at the source, I've done Apache hacking before.<br><br>
Regards,<br><br>
Faisal</font></body>
</html>
--=====================_227285703==.ALT--