You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Federico M." <fg...@yahoo.com.ar> on 2004/11/29 14:20:25 UTC

Handling the User pressed Stop button case - problems

Hi, what's wrong whit this script.
I need to detect when the user press the stop button.
I read:

http://perl.apache.org/docs/1.0/guide/debug.html#Handling_the__User_pressed_Stop_button__case



SO: Debian Sarge.

This is my apache.http:
-----------------------

# If the perl module is installed, this will be
enabled.
<IfModule mod_perl.c>
  <IfModule mod_alias.c>
   Alias /perl/ /var/www/perl/
  </IfModule>
  <Location /perl>
    SetHandler perl-script
    PerlHandler Apache::Registry
    PerlFixupHandler Apache::SIG LogFormat "%h %l %u
%t \"%r\" %s %b &{SIGPIPE}e"
    Options +ExecCGI
  </Location>
</IfModule>

I have mod_perl.so, but don't have mod_perl.c

This is my script:
------------------

#!/usr/bin/perl
$r->send_http_header;
print"PID=$$\n";
$r->rflush;
while(1)
{
$r->print("\0");
$r->rflush;
last if $r->connection->aborted;
$i++;
sleep 1;
}



This is the ERROR:
------------------

Can't call method "send_http_header" on an undefined
value at scan2.cgi line 3.




Thanks for your time, sorry for my bad english.


	

	
		
___________________________________ 
¡Llevate a Yahoo! en tu Unifón! 
Ahora podés usar Yahoo! Messenger en tu Unifón, en cualquier momento y lugar. 
Encontrá más información en: http://ar.mobile.yahoo.com/sms.html 


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


Re: Handling the User pressed Stop button case - problems

Posted by Stas Bekman <st...@stason.org>.
Federico M. wrote:
> Sorry, this is my source.
> 
> 
> #!/usr/bin/perl
> my $r=shift;
> $r->send_http_header('text/plain');
[...]
> ERROR: Can't call method "send_http_header" on an
> undefined value at scan2.cgi line 3.

bizarre, are you sure you don't have some other config and it tries to run 
it under mod_cgi instead? replace this with a simple test:

#!/usr/bin/perl
print "Content-type: text/plain\n\n";
print "Running under mod_" . ($ENV{MOD_PERL} ? "perl" : "cgi");


-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org 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


Re: Handling the User pressed Stop button case - problems

Posted by "Federico M." <fg...@yahoo.com.ar>.
Sorry, this is my source.


#!/usr/bin/perl
my $r=shift;
$r->send_http_header('text/plain');
print"PID=$$\n";
$r->rflush;
while(1)
{
$r->print("\0");
$r->rflush;
last if $r->connection->aborted;
$i++;
sleep 1;
}


ERROR: Can't call method "send_http_header" on an
undefined value at scan2.cgi line 3.




 --- Michael Peters <mp...@plusthree.com> escribió: 
> 
> Federico M. wrote:
> > Hi, what's wrong whit this script.
> > I need to detect when the user press the stop
> button.
> > I read:
> > 
> >
>
http://perl.apache.org/docs/1.0/guide/debug.html#Handling_the__User_pressed_Stop_button__case
> > 
> > 
> > 
> > SO: Debian Sarge.
> > 
> > This is my apache.http:
> > -----------------------
> > 
> > # If the perl module is installed, this will be
> > enabled.
> > <IfModule mod_perl.c>
> >   <IfModule mod_alias.c>
> >    Alias /perl/ /var/www/perl/
> >   </IfModule>
> >   <Location /perl>
> >     SetHandler perl-script
> >     PerlHandler Apache::Registry
> >     PerlFixupHandler Apache::SIG LogFormat "%h %l
> %u
> > %t \"%r\" %s %b &{SIGPIPE}e"
> >     Options +ExecCGI
> >   </Location>
> > </IfModule>
> > 
> > I have mod_perl.so, but don't have mod_perl.c
> > 
> > This is my script:
> > ------------------
> > 
> > #!/usr/bin/perl
> 
> you need to assign the request object to $r
> 
>    my $r = shift;
> 
> > $r->send_http_header;
> > print"PID=$$\n";
> > $r->rflush;
> > while(1)
> > {
> > $r->print("\0");
> > $r->rflush;
> > last if $r->connection->aborted;
> > $i++;
> > sleep 1;
> > }
> 
> If you had put a 'use strict' in there at the top it
> might have been 
> easier to see this.
> 
> -- 
> Michael Peters
> Developer
> Plus Three, LP
> 
>  

Correo Yahoo! - 6 MB, tecnología antispam ¡gratis! 
 Suscribite ya http://correo.yahoo.com.ar/

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


Re: Handling the User pressed Stop button case - problems

Posted by Michael Peters <mp...@plusthree.com>.
Federico M. wrote:
> Hi, what's wrong whit this script.
> I need to detect when the user press the stop button.
> I read:
> 
> http://perl.apache.org/docs/1.0/guide/debug.html#Handling_the__User_pressed_Stop_button__case
> 
> 
> 
> SO: Debian Sarge.
> 
> This is my apache.http:
> -----------------------
> 
> # If the perl module is installed, this will be
> enabled.
> <IfModule mod_perl.c>
>   <IfModule mod_alias.c>
>    Alias /perl/ /var/www/perl/
>   </IfModule>
>   <Location /perl>
>     SetHandler perl-script
>     PerlHandler Apache::Registry
>     PerlFixupHandler Apache::SIG LogFormat "%h %l %u
> %t \"%r\" %s %b &{SIGPIPE}e"
>     Options +ExecCGI
>   </Location>
> </IfModule>
> 
> I have mod_perl.so, but don't have mod_perl.c
> 
> This is my script:
> ------------------
> 
> #!/usr/bin/perl

you need to assign the request object to $r

   my $r = shift;

> $r->send_http_header;
> print"PID=$$\n";
> $r->rflush;
> while(1)
> {
> $r->print("\0");
> $r->rflush;
> last if $r->connection->aborted;
> $i++;
> sleep 1;
> }

If you had put a 'use strict' in there at the top it might have been 
easier to see this.

-- 
Michael Peters
Developer
Plus Three, LP


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