Re: Scripts and HTML docs in the same directory (+ modperl newbieexperiences)

2003-02-27 Thread Mark James
Stas Bekman wrote:
Mark James wrote:
1. In http://perl.apache.org/docs/1.0/guide/getwet.html , use of x.x.x
   for both the Apache and mod_perl version numbers made me think that
   the version numbers had to be matched.  Maybe y.y.y should be used
   for one.  
Please get used to x.x.x meaning any. Otherwise we would need to 
remember to use z.z.z. for php plugs in and f.f.f. when openssl is 
added, etc... hope you get the idea.
When they're discussed in the same sentence, and when building one
requires linking to the installation or source directory of the other,
I think a different variable helps.
2. In the configuration section of the 2.0 docs
   
(http://perl.apache.org/docs/2.0/user/intro/start_fast.html#toc_Configuration) 

   it neglects to state the need to issue a directive for the mod_perl
   handler one is going to use, e.g. PerlModule ModPerl::Registry,
   though it is covered in the configuration docs (including the
   startup-file option).


you mean preloading the module? That's not necessarily in mp2, though 
advisable for performance reasons.

In mp2, you can say:

  PerlResponseHandler ModPerl::Registry

without:

  PerlModule ModPerl::Registry
Well I just commented out use ModPerl::Registry () in my startup
script and it still worked.  But earlier I had found that adding
PerlModule ModPerl::Registry the http.conf was the key to getting
rid of the rash of error messages I was getting on server start-up.
It must have been a manifestation of some other problem, perhaps
with mod_perl-1.99_08 (now using the CVS version to fix a missing OPEN
in Apache::RequestRec, and to avoid the failed perlio tests), or
with an older CGI.pm (found out late that CGI=2.89 was needed).

you can also use the syntactic sugar to preload modules, by simply 
stating at the beginning of your mod_perl configuration 'PerlOptions 
+Autoload'. See
http://perl.apache.org/docs/2.0/user/config/config.html#C_AutoLoad_

or using + before the handler name:

PerlResponseHandler +ModPerl::Registry
OK, so 2.0 is not like 1.0 where PerlModule acts like use()
(http://perl.apache.org/docs/1.0/guide/config.html#PerlModule_and_PerlRequire_Directives),
but is more like @INC manipulation; and these handler autoload
directives are an alternative to use-ing them in a start-up
script.
My start-up script is very long because it calls use for
just about every package in an extensive package set.
I suppose an import function could be created in a master
package of package suite that when called require-ed
all the associated packages, so that mod_perl can have the
entire suite pre-loaded prior to forking through just one
line in the start-up script.
Thank you Stas for your prompt help.

Mark



Re: Scripts and HTML docs in the same directory (+ modperl newbieexperiences)

2003-02-27 Thread Stas Bekman
Mark James wrote:
Stas Bekman wrote:

Mark James wrote:

1. In http://perl.apache.org/docs/1.0/guide/getwet.html , use of x.x.x
   for both the Apache and mod_perl version numbers made me think that
   the version numbers had to be matched.  Maybe y.y.y should be used
   for one.  
Please get used to x.x.x meaning any. Otherwise we would need to 
remember to use z.z.z. for php plugs in and f.f.f. when openssl is 
added, etc... hope you get the idea.


When they're discussed in the same sentence, and when building one
requires linking to the installation or source directory of the other,
I think a different variable helps.
since I've already changed them to be mod_perl-1.xx and apache_1.3.xx there 
shouldn't be a confusion anymore.

2. In the configuration section of the 2.0 docs
   
(http://perl.apache.org/docs/2.0/user/intro/start_fast.html#toc_Configuration) 

   it neglects to state the need to issue a directive for the mod_perl
   handler one is going to use, e.g. PerlModule ModPerl::Registry,
   though it is covered in the configuration docs (including the
   startup-file option).


you mean preloading the module? That's not necessarily in mp2, though 
advisable for performance reasons.

In mp2, you can say:

  PerlResponseHandler ModPerl::Registry

without:

  PerlModule ModPerl::Registry


Well I just commented out use ModPerl::Registry () in my startup
script and it still worked.  But earlier I had found that adding
PerlModule ModPerl::Registry the http.conf was the key to getting
rid of the rash of error messages I was getting on server start-up.
It must have been a manifestation of some other problem, perhaps
with mod_perl-1.99_08 (now using the CVS version to fix a missing OPEN
in Apache::RequestRec, and to avoid the failed perlio tests), or
with an older CGI.pm (found out late that CGI=2.89 was needed).
Bugs get fixed ;)

you can also use the syntactic sugar to preload modules, by simply 
stating at the beginning of your mod_perl configuration 'PerlOptions 
+Autoload'. See
http://perl.apache.org/docs/2.0/user/config/config.html#C_AutoLoad_

or using + before the handler name:

PerlResponseHandler +ModPerl::Registry


OK, so 2.0 is not like 1.0 where PerlModule acts like use()
(http://perl.apache.org/docs/1.0/guide/config.html#PerlModule_and_PerlRequire_Directives), 

but is more like @INC manipulation; and these handler autoload
directives are an alternative to use-ing them in a start-up
script.
No, it works exactly the same. It's just that in 2.0 you don't have to preload 
the modules. An attempt to load them will happen when they will be used for 
the first time.

My start-up script is very long because it calls use for
just about every package in an extensive package set.
I suppose an import function could be created in a master
package of package suite that when called require-ed
all the associated packages, so that mod_perl can have the
entire suite pre-loaded prior to forking through just one
line in the start-up script.
You can certainly do that. Or you can even preload *all* available mp2 packages :)
http://perl.apache.org/docs/2.0/api/ModPerl/MethodLookup.html#preload_all_modules__
Thank you Stas for your prompt help.
;)



__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Scripts and HTML docs in the same directory (+ modperl newbieexperiences)

2003-02-26 Thread Perrin Harkins
On Wed, 2003-02-26 at 23:16, Mark James wrote:
 One question: Prior to using mod_perl I was able to have
 unsuffixed scripts and .html files residing together in the
 server root directory by using Apache's Files directive to
 force the scripts to be executed: e.g.
 
  Files db
  ForceType application/x-httpd-cgi
  /Files
 
 I can't seem to do this with mod_perl because I now have to use
 a SetHandler directive on the directory

You should be able to do the SetHandler inside a Files directive just
like you did with ForceType.  Have you tried that?

- Perrin



Re: Scripts and HTML docs in the same directory (+ modperl newbieexperiences)

2003-02-26 Thread Stas Bekman
Mark James wrote:
Hello All,

Took me a day, but I think I've finally been able to move my
scripts from plain cgi perl to mod_perl2.  The extensive documention
on perl.apache.org was invaluable, though I have some comments below.
One question: Prior to using mod_perl I was able to have
unsuffixed scripts and .html files residing together in the
server root directory by using Apache's Files directive to
force the scripts to be executed: e.g.
Files db
ForceType application/x-httpd-cgi
/Files
I can't seem to do this with mod_perl because I now have to use
a SetHandler directive on the directory, so Apache now executes
the HTML files.  I've tried forcing the scripts to type
application/x-httpd-perl, but this doesn't work.
I'd like to keep both the scripts and HTML docs in the root
directory so that URLs are as short as possible, but can I
do this with mod_perl without having to use URL re-writing?
Set the normal behavior per dir/location and then override for specific files

  Location /perl
 SetHandler perl-script
 ...
  /Location
  Files *.html
SetHandler default
  /Files
if I remember correctly you can even nest that Files container inside the 
Location container.

Finally, some comments on mod_perl installation:

1. In http://perl.apache.org/docs/1.0/guide/getwet.html , use of x.x.x
   for both the Apache and mod_perl version numbers made me think that
   the version numbers had to be matched.  Maybe y.y.y should be used
   for one.  
Please get used to x.x.x meaning any. Otherwise we would need to remember to 
use z.z.z. for php plugs in and f.f.f. when openssl is added, etc... hope you 
get the idea.

It also should be stated in this section that one has to
   use mod_perl-2.x if one is running Apache 2.y.
yup, thank you, will fix that shortly.

2. In the configuration section of the 2.0 docs
   
(http://perl.apache.org/docs/2.0/user/intro/start_fast.html#toc_Configuration) 

   it neglects to state the need to issue a directive for the mod_perl
   handler one is going to use, e.g. PerlModule ModPerl::Registry,
   though it is covered in the configuration docs (including the
   startup-file option).
you mean preloading the module? That's not necessarily in mp2, though 
advisable for performance reasons.

In mp2, you can say:

  PerlResponseHandler ModPerl::Registry

without:

  PerlModule ModPerl::Registry

you can also use the syntactic sugar to preload modules, by simply stating at 
the beginning of your mod_perl configuration 'PerlOptions +Autoload'. See
http://perl.apache.org/docs/2.0/user/config/config.html#C_AutoLoad_

or using + before the handler name:

PerlResponseHandler +ModPerl::Registry

Thanks to all mod_perl coders!
Thanks for the comments.

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Scripts and HTML docs in the same directory (+ modperl newbieexperiences)

2003-02-26 Thread Mark James
Perrin Harkins wrote:
You should be able to do the SetHandler inside a Files directive just
like you did with ForceType.  Have you tried that?
Thanks Perrin, that worked.  I didn't think SetHandler directives
were allowed in Files sections, because it's not listed in the SetHandler
docs (http://httpd.apache.org/docs-2.0/mod/core.html#sethandler), unlike
ForceType docs (http://httpd.apache.org/docs-2.0/mod/core.html#forcetype)
Stas Bekman wrote:
 Set the normal behavior per dir/location and then override for specific
 files
Stas' solution would therefore work as well.

Mark