Embedded perl ssi weirdness?

hi, folks, I’ve been trying out the embedded perl feature with 0.6.31,
and
while there were initially some problems with getting it up, I’ve
managed to
resolve just about everything. I do have some questions, though:

  1. I’ve been trying to get Perl SSI to work “inline” (eg. perl sub=’{ my
    $r
    = shift; $r->print(time); }’ ), but so far that hasn’t worked out at
    all.
    Must the perl sub always be defined elsewhere, in a “.pm” file?

  2. I notice that changes to the “.pm” files are not dynamic, or
    “on-the-fly”. You have to restart nginx in order for the changes to be
    reflected. Is this intentional?

thanks,
-jf


In the meantime, here is your PSA:
“It’s so hard to write a graphics driver that open-sourcing it would not
help.”
– Andrew Fear, Software Product Manager, NVIDIA Corporation
http://kerneltrap.org/node/7228

On Sun, May 25, 2008 at 04:57:18PM +0800, Jeffrey ‘jf’ Lim wrote:

hi, folks, I’ve been trying out the embedded perl feature with 0.6.31, and
while there were initially some problems with getting it up, I’ve managed to
resolve just about everything. I do have some questions, though:

  1. I’ve been trying to get Perl SSI to work “inline” (eg. perl sub=’{ my $r
    = shift; $r->print(time); }’ ), but so far that hasn’t worked out at all.
    Must the perl sub always be defined elsewhere, in a “.pm” file?

Yes, the code that allows SSI perl inlines are explicitly disabled at
line 393 in src/http/modules/perl/ngx_http_perl_module.c for perfomance
reasons. I’m not sure should it be enabled or not.

  1. I notice that changes to the “.pm” files are not dynamic, or
    “on-the-fly”. You have to restart nginx in order for the changes to be
    reflected. Is this intentional?

Yes, you need to reconfigure nginx (if perl was built with threads or
multiplicty interpeters support) or to do online uprade (if perl is
single
interpeter). I simply do know how to test all involved files.

On Sun, May 25, 2008 at 9:18 PM, Igor S. [email protected] wrote:

= shift; $r->print(time); }’ ), but so far that hasn’t worked out at all.
Must the perl sub always be defined elsewhere, in a “.pm” file?

Yes, the code that allows SSI perl inlines are explicitly disabled at
line 393 in src/http/modules/perl/ngx_http_perl_module.c for perfomance
reasons. I’m not sure should it be enabled or not.

ah, so that’s what that was for then! I had a look through the code, but
couldnt really figure this portion of the code out. Thanks!

  1. I notice that changes to the “.pm” files are not dynamic, or
    “on-the-fly”. You have to restart nginx in order for the changes to be
    reflected. Is this intentional?

Yes, you need to reconfigure nginx (if perl was built with threads or
multiplicty interpeters support) or to do online uprade (if perl is single
interpeter). I simply do know how to test all involved files.

Are you saying that I need to reconfigure nginx with a different set of
options, or that the fault is with my perl setup, and that I should
upgrade
my perl, and then reconfigure nginx?

‘perl -V’ gives me


Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT
PERL_MALLOC_WRAP THREADS_HAVE_PIDS
USE_64_BIT_ALL
USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
USE_PERLIO USE_REENTRANT_API

so I’m assuming here that my perl should be built with threads and
multiplicity already?

-jf


In the meantime, here is your PSA:
“It’s so hard to write a graphics driver that open-sourcing it would not
help.”
– Andrew Fear, Software Product Manager, NVIDIA Corporation
http://kerneltrap.org/node/7228

On Sun, May 25, 2008 at 09:39:15PM +0800, Jeffrey ‘jf’ Lim wrote:

On Sun, May 25, 2008 at 9:18 PM, Igor S. [email protected] wrote:

On Sun, May 25, 2008 at 04:57:18PM +0800, Jeffrey ‘jf’ Lim wrote:

options, or that the fault is with my perl setup, and that I should upgrade
my perl, and then reconfigure nginx?

No, nginx reconfiguration is -HUP signal, online upgrade is -USR2
signal.

so I’m assuming here that my perl should be built with threads and
multiplicity already?

You have at least multiplicity interpereters. What does
perl -V:usemultiplicity -V:usethreads
show ?

On Sun, May 25, 2008 at 9:45 PM, Igor S. [email protected] wrote:

Are you saying that I need to reconfigure nginx with a different set of
options, or that the fault is with my perl setup, and that I should
upgrade
my perl, and then reconfigure nginx?

No, nginx reconfiguration is -HUP signal, online upgrade is -USR2 signal.

ah, ok. Sorry about that. Didnt know about the terminology there. In
this
case then, I guess my questions are just about answered - so the restart
bit
is intentional, and you can either restart nginx totally, do a -HUP, or
do a
-USR2…

You have at least multiplicity interpereters. What does

perl -V:usemultiplicity -V:usethreads
show ?

it gives me the following:
usemultiplicity=‘define’;
usethreads=‘define’;

-jf


In the meantime, here is your PSA:
“It’s so hard to write a graphics driver that open-sourcing it would not
help.”
– Andrew Fear, Software Product Manager, NVIDIA Corporation
http://kerneltrap.org/node/7228

On Sun, May 25, 2008 at 10:04:25PM +0800, Jeffrey ‘jf’ Lim wrote:

it gives me the following:
usemultiplicity=‘define’;
usethreads=‘define’;

This means that you have threaded perl.