[edit] perl_set

Syntax: perl_set $variable module :: function |'sub { ... }'
Default:
Context: http
Reference: perl_set


Directive establishes the function of variable ???

[edit] Calling Perl from SSI

Instruction format is as follows:

<!--# perl sub="module::function" arg="parameter1" arg="parameter2"...
-->

[edit] Methods of request object $r

package hello;
 
use nginx;
 
sub handler {
  my $r = shift;
 
  if ($r->request_method ne "POST") {
    return DECLINED;
  }
 
  if ($r->has_request_body(\&post)) {
    return OK;
  }
 
  return 400;
}
 
sub post {
  my $r = shift;
  $r->send_http_header;
  $r->print("request_body: \"", $r->request_body, "\"<br/>");
  $r->print("request_body_file: \"", $r->request_body_file, "\"<br/>\n");
  return OK;
}
 
1;
 
__END__
So that the body of the demand of client is guaranteed to remain in memory, it is necessary to limit its size with the aid
of client_max_body_size and to assign sufficient size for the buffer using client_body_buffer_size.
package hello; 
 
use nginx; 
 
sub handler {
   my $r = shift; 
 
  $r->discard_request_body; 
  $r->variable("var", "OK"); 
  $r->sleep(1000, \&next); 
 
  return OK; 
}
 
sub next {
  my $r = shift; 
 
  $r->send_http_header; 
  $r->print($r->variable("var")); 
 
  return OK;
} 
 
1; 
__END__

[edit] References

Original Documentation


Module: HttpPerlModule