Loading ...
Sorry, an error occurred while loading the content.
 

Re: END block weird behavior

Expand Messages
  • Stas Bekman
    ... Right I can see that now. I shouldn t have alternating requesting the two. Didn t realise the two very connected (the same script) ... That s easy - use a
    Message 1 of 5 , Dec 2 7:29 AM
      Faisal Nasim wrote:
      > 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.

      Right I can see that now. I shouldn't have alternating requesting the two.
      Didn't realise the two very connected (the same script)

      > 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.

      That's easy - use a cleanup handler:
      http://perl.apache.org/docs/1.0/guide/porting.html#END_blocks

      > I can take a crack
      > at the source, I've done Apache hacking before.

      That would be certainly great. We need more people who can solve core
      problems. There are too few of us trying to handle the ever raising load.

      --
      __________________________________________________________________
      Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
      http://stason.org/ mod_perl Guide ---> http://perl.apache.org
      mailto:stas@... http://use.perl.org http://apacheweek.com
      http://modperlbook.org http://apache.org http://ticketmaster.com

      --
      Report problems: http://perl.apache.org/bugs/
      Mail list info: http://perl.apache.org/maillist/modperl.html
      List etiquette: http://perl.apache.org/maillist/email-etiquette.html
    Your message has been successfully submitted and would be delivered to recipients shortly.