Re: Storing variables in memory

2003-12-20 Thread Eric Sammer
Chris Ochs wrote:
I have an application where known users connect, and normally I do a db
query to get their configuration information.  What I would like to do is
preload all of this information into memory, say into a global hash where
all the mod perl processes can access it.
You want to use one of the many caching options. You should take a look 
at Cache::Cache or MLDBM::Sync. There are others as well. Personally, I 
use MLDBM::Sync (stores multi-level data structures in dbm files and 
allows for locking). MLDBM::Sync is implemented (as most of them are, I 
believe) as a tied hash so it works just about how you think it would.

If you wanted to truly preload it (i.e. at server startup time) you 
could write a bit of code in your mod_perl startup.pl file.

Perrin Harkins / Bill Hilf wrote a bit about this here:
http://perl.apache.org/docs/tutorials/apps/scale_etoys/etoys.html
It has also be discussed on this list many time. Search the archives.

See also:

http://search.cpan.org/~chamas/MLDBM-Sync-0.30/Sync.pm
http://search.cpan.org/~dclinton/Cache-Cache-1.02/lib/Cache/Cache.pm
(There are other modules that work equally well.)

And since the primary goal is making the program faster, any alternatives
that would take longer than a database select wouldnt' do me any good.
Any DBM file or shared memory caching will be infinitely faster than 
making a DB round trip. There is usually some initial overhead during 
the initial fetch because it has to fetch the info from the rdbms and 
then write it to the cache, but it's trivial when you consider the benefits.

HTH.
--
Eric Sammer
[EMAIL PROTECTED]
http://www.ineoconcepts.com
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Storing variables in memory

2003-12-20 Thread Perrin Harkins
Eric Sammer wrote:
Any DBM file or shared memory caching will be infinitely faster than 
making a DB round trip.
Actually, it turns out that this is no longer true.  MySQL is really 
fast these days.  A simple query on a local MySQL is faster than just 
about anything except IPC::MM or BerkeleyDB (using built-in locking).

MLDBM::Sync is still fast enough for most uses, and faster than a 
complex query (joins or multiple items in the WHERE clause) on most 
databases.

If the data in question is small enough to fit in memory and doesn't 
need to be updated while the server is running, there are instructions 
in the Guide as well as the books about how to preload the data during 
startup.

- Perrin

--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Storing variables in memory

2003-12-20 Thread Eric Sammer
Perrin Harkins wrote:
Eric Sammer wrote:

Any DBM file or shared memory caching will be infinitely faster than 
making a DB round trip.
Actually, it turns out that this is no longer true.  MySQL is really 
fast these days.  A simple query on a local MySQL is faster than just 
about anything except IPC::MM or BerkeleyDB (using built-in locking).
I suppose that's true. I was also taking into account (potential) 
network lag if the rdbms is running on another box. Of course, I was 
also trying to be rdbms agnostic, to be fair. ;)

I've been running with postgres for most of our recent projects, but 
most of them have to run with just about anything that DBI uses so 
having a caching layer helps. I've noticed a sizable increase in 
performance when testing with ab and jmeter. Also, according to 
Apache::DProf, things are running smoother.

MLDBM::Sync is still fast enough for most uses, and faster than a 
complex query (joins or multiple items in the WHERE clause) on most 
databases.
I've had fantastic luck with MLDBM::Sync thus far, not that it's the all 
in one wonder tool.

--
Eric Sammer
[EMAIL PROTECTED]
http://www.ineoconcepts.com
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Storing variables in memory

2003-12-20 Thread Perrin Harkins
Eric Sammer wrote:
I've had fantastic luck with MLDBM::Sync thus far, not that it's the all 
in one wonder tool.
I think it's a great tool, especially when you need easy access to 
complex data structures, but I wanted to point the non-intuitive fact 
that a local MySQL can be a great cache for a remote database, and is 
actually faster than all of the other shared memory or file-based 
solutions except IPC::MM and BerkeleyDB.  I will have a full article 
about this soon.

- Perrin



--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Storing variables in memory

2003-12-20 Thread harm
On Sat, Dec 20, 2003 at 11:16:53AM -0500, Perrin Harkins wrote:
> Eric Sammer wrote:
> >I've had fantastic luck with MLDBM::Sync thus far, not that it's the all 
> >in one wonder tool.
> 
> I think it's a great tool, especially when you need easy access to 
> complex data structures, but I wanted to point the non-intuitive fact 
> that a local MySQL can be a great cache for a remote database, and is 
> actually faster than all of the other shared memory or file-based 
> solutions except IPC::MM and BerkeleyDB.  I will have a full article 
> about this soon.

Another approach to the caching problem is memcached:
http://www.danga.com/memcached/

it is a C daemon which you access over a socket. It is key=>value based
storage and if you use it to store strings it is _really_ fast. (You
can put arbitrary perl objects in there, but it uses Storable.pm which makes
it a little slower).  This is great to store pieces of HTML. 
Since it is a seperate process it stores every value
once and there is no copy for every mod_perl process. If the parserd deamon dies the 
perl
client will just ignore the caching and go on uncached. It will try every now and then 
to
see if the daemon got restarted.


Little bechmark (source attached):

Benchmark: timing 4 iterations of cache_filecache, cache_memcached, 
cache_memorycache, notcached...
cache_filecache: 20 wallclock secs (15.25 usr +  2.65 sys = 17.90 CPU) @ 2234.64/s 
(n=4)
cache_memcached:  5 wallclock secs ( 2.62 usr +  1.08 sys =  3.70 CPU) @ 10810.81/s 
(n=4)
cache_memorycache:  7 wallclock secs ( 5.70 usr +  0.04 sys =  5.74 CPU) @ 6968.64/s 
(n=4)
 notcached:  6 wallclock secs ( 5.56 usr +  0.01 sys =  5.57 CPU) @ 7181.33/s (n=4)


The 'wallclock secs' are the ones to watch because usr/sys are incomplete
since mamcached uses a seperate process.
The cached routine is this very interesting (yeah, right) routine:

foreach (sort 1..100) {
 $ret .= qq'> $_';
}
return $ret;

anything more fancy then this will only make the difference between memcached
and notcached bigger :)





Harmen
(Ok, this it not suited for complex structures which this thread is about but maybe 
someone can use it nevertheless.)



-- 
   The Moon is Waning Crescent (10% of Full)
tty.nl - muziek-en-artiesten.2dehands.nl: 107625
# Cache::* becnhmark
use strict;
use warnings;
use Cache::FileCache;
use Cache::MemoryCache;
use Cache::Memcached;
use Benchmark;

my $filecache = new Cache::FileCache( { namespace => 'TweedTest',
default_expires_in => 60 * 15,
directory_umask => '000',
} );
my $memorycache = new Cache::MemoryCache( { namespace => 'TweedTest',
default_expires_in => 60 * 15,
directory_umask => '000',
} );
my $memcached = new Cache::Memcached {
'servers' => ["127.0.0.1:11211"],
'debug' => 0,
};


### The HTML we need to generate:
sub getmenu {
my $ret;
foreach (sort 1..100) {
 $ret .= qq'> $_';
}
return $ret;
}

sub getit_filecache {
my $key = shift;
my $data = $filecache->get($key);
if (not defined $data) {
$data = getmenu();
$filecache->set($key, $data);
}
return $data;
}
sub getit_memorycache {
my $key = shift;
my $data = $memorycache->get($key);
if (not defined $data) {
$data = getmenu();
$memorycache->set($key, $data);
}
return $data;
}
sub getit_memcached {
my $key = shift;
my $data = $memcached->get($key);
if (not defined $data) {
$data = getmenu();
$memcached->set($key, $data);
}
return $data;
}


timethese (40_000, { 
 cache_filecache=> "getit_filecache('test12')",
 cache_memorycache  => "getit_memorycache('test12')",
 cache_memcached=> "getit_memcached('test12')",
 notcached  => "getmenu()",
   }
);

-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html

Re: introducing new code with no perceived user delays?

2003-12-20 Thread Fred Moyer
On Thu, 2003-12-18 at 04:15, Stas Bekman wrote:
> Rob Nagler wrote:
> > Brian Hirt writes:
> > 
> >>Once everything is running on the 
> >>new mod perl, i shut down the original mod perl application.  There is 
> >>about 0.5 seconds of lag while the proxy reloads the rules.
> > 
> > 
> > We use proxies, but instead of modifying the proxy config, we use a
> > Rewrite rule of the form:
> > 
> > RewriteMap maps txt:/etc/httpd.maps
> > RewriteRule ^(.*) http://${maps:appserver}$1 [proxy]
> > 
> > When we release, we edit the /etc/httpd.maps file to point to a
> > different port or machine.
> > 
> > appserver foo.com:
> > 
> > mod_rewrite rereads (or checks mtime of) the file on every request so
> > the change takes effect immediately.
> 
> That sounds like something that we want to have in the mod_perl documentation. 
> Would someone come up with a doc patch? I think the perfect place for this 
> would be: http://perl.apache.org/docs/1.0/guide/scenario.html

I had some free time last night so I wrote up a patch to
http://perl.apache.org/docs/1.0/guide/scenario.pod.orig. It includes
some of these list threads and splits up the examples so they are a bit
clearer to someone reading it for the first time.  Hope this can be
useful.

1657,1659d1655
< Example code for using mod_rewrite with mod_perl application servers.
Several examples were taken from the mailing list.
<
< =head2 Rewriting Requests Based on File Extension
<
1693c1689
< =head2 Internet Exporer 5 favicon.ico 404
---
> More examples:
1699,1700d1694
< =head2 Hiding Extensions for Dynamic Pages
<
1705,1706d1698
< =head2 Serving Static Content Locally and Rewriting Everything Else
<
1749,1777d1740
< =head2 Upgrading mod_perl Heavy Application Instances
<
< When using a light/heavy separation method one of the challenges of
running a production environment is being able to upgrade to newer
versions of mod_perl or your own application. The following method can
be used without having to do a server restart.
<
< Add the following rewrite rule to your httpd.conf file:
<
<   RewriteEngine On
<   RewriteMap maps txt:/etc/httpd.maps
<   RewriteRule ^(.*) http://${maps:appserver}$1 [proxy]
<
< Create the file /etc/httpd.maps and add the following entry:
<
<   appserver foo.com:
<
< Mod_rewrite rereads (or checks the mtime of) the file on every request
so the change takes effect immediately. To seamlessly upgrade your
application server to a new version, install a new version on a
different port. After checking for a quality installation, edit
/etc/httpd.maps to point to the new server. After the file is written
the next request the server processes will be redirected to the new
installation.
<
< =head2 Blocking IP Addresses
<
< The following rewrite code blocks IP addresses:
<
<   RewriteCond /web/site/var/blocked/REMOTE_ADDR-%{REMOTE_ADDR} -f
<   RewriteRule .* http://YOUR-HOST-BLOCKED-FOR-EXCESSIVE-CONSUMPTION
[redirect,last]
<
< To block IP address 10.1.2.3, simply touch
<
<   /web/site/var/blocked/REMOTE_ADDR-10.1.2.3
<
< This has an advantage over Apache parsing a long file of addresses in
that the OS is better at a file lookup.
<


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: introducing new code with no perceived user delays?

2003-12-20 Thread Randal L. Schwartz
> "Fred" == Fred Moyer <[EMAIL PROTECTED]> writes:

Fred> < =head2 Blocking IP Addresses
Fred> <
Fred> < The following rewrite code blocks IP addresses:
Fred> <
Fred> <   RewriteCond /web/site/var/blocked/REMOTE_ADDR-%{REMOTE_ADDR} -f
Fred> <   RewriteRule .* http://YOUR-HOST-BLOCKED-FOR-EXCESSIVE-CONSUMPTION
Fred> [redirect,last]
Fred> <
Fred> < To block IP address 10.1.2.3, simply touch
Fred> <
Fred> <   /web/site/var/blocked/REMOTE_ADDR-10.1.2.3
Fred> <
Fred> < This has an advantage over Apache parsing a long file of addresses in
Fred> that the OS is better at a file lookup.

Hey, that looks familiar.  Do I get credit? :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: introducing new code with no perceived user delays?

2003-12-20 Thread Fred Moyer
On Sat, 2003-12-20 at 20:29, Randal L. Schwartz wrote:
> > "Fred" == Fred Moyer <[EMAIL PROTECTED]> writes:
> 
> Fred> < =head2 Blocking IP Addresses
> Fred> <
> Fred> < The following rewrite code blocks IP addresses:
> Fred> <
> Fred> <   RewriteCond /web/site/var/blocked/REMOTE_ADDR-%{REMOTE_ADDR} -f
> Fred> <   RewriteRule .* http://YOUR-HOST-BLOCKED-FOR-EXCESSIVE-CONSUMPTION
> Fred> [redirect,last]
> Fred> <
> Fred> < To block IP address 10.1.2.3, simply touch
> Fred> <
> Fred> <   /web/site/var/blocked/REMOTE_ADDR-10.1.2.3
> Fred> <
> Fred> < This has an advantage over Apache parsing a long file of addresses in
> Fred> that the OS is better at a file lookup.
> 
> Hey, that looks familiar.  Do I get credit? :)

I'm not familiar with the protocol regarding credit for the mod_perl
documentation but this updated patch gives credit to the contributors :)
  
1656,1659d1655
< Example code for using mod_rewrite with mod_perl application servers. Several 
examples were taken from the mailing list.
< 
< =head2 Rewriting Requests Based on File Extension
< 
1693c1689
< =head2 Internet Exporer 5 favicon.ico 404
---
> More examples:
1699,1700d1694
< =head2 Hiding Extensions for Dynamic Pages
< 
1705,1706d1698
< =head2 Serving Static Content Locally and Rewriting Everything Else
< 
1749,1777d1740
< =head2 Upgrading mod_perl Heavy Application Instances
< 
< Contributed to the mailing list on 12/18/03 by Rob Nagler
< When using a light/heavy separation method one of the challenges of running a 
production environment is being able to upgrade to newer versions of mod_perl or your 
own application. The following method can be used without having to do a server 
restart.
< 
< Add the following rewrite rule to your httpd.conf file:
< 
<   RewriteEngine On
<   RewriteMap maps txt:/etc/httpd.maps
<   RewriteRule ^(.*) http://${maps:appserver}$1 [proxy]
< 
< Create the file /etc/httpd.maps and add the following entry:
< 
<   appserver foo.com:
< 
< Mod_rewrite rereads (or checks the mtime of) the file on every request so the change 
takes effect immediately. To seamlessly upgrade your application server to a new 
version, install a new version on a different port. After checking for a quality 
installation, edit /etc/httpd.maps to point to the new server. After the file is 
written the next request the server processes will be redirected to the new 
installation.
< 
< =head2 Blocking IP Addresses
< 
< Contributed to the mailing list on 12/18/03 by Randal L. Schwartz
< The following rewrite code blocks IP addresses:
< 
<   RewriteCond /web/site/var/blocked/REMOTE_ADDR-%{REMOTE_ADDR} -f
<   RewriteRule .* http://YOUR-HOST-BLOCKED-FOR-EXCESSIVE-CONSUMPTION [redirect,last]
< 
< To block IP address 10.1.2.3, simply touch
< 
<   /web/site/var/blocked/REMOTE_ADDR-10.1.2.3
< 
< This has an advantage over Apache parsing a long file of addresses in that the OS is 
better at a file lookup.
< 




-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



RE: using pnotes to store/retrieve Class::DBI objects?

2003-12-20 Thread Eric J. Hansen
Hurrah!  Its working now.  Thank you!

Eric


> > When I try to retrieve this Class::DBI object from the Cleanup 
> > Handler, the pnotes values are totally gone.  However, 
> regular scalers 
> > that I've put in 'notes' are still there. Perhaps pnotes has (by 
> > design) already been cleaned up prior to the 
> PerlCleanupHandler stage?
> 
> Right, here is the fix:
> 
> Index: src/modules/perl/modperl_config.c 
> ===
> RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_config.c,v
> retrieving revision 1.71
> diff -u -r1.71 modperl_config.c
> --- src/modules/perl/modperl_config.c   23 Oct 2003 18:34:51 
> -  1.71
> +++ src/modules/perl/modperl_config.c   20 Dec 2003 02:46:41 -
> @@ -288,12 +288,12 @@
>   apr_status_t retval;
>   MP_dRCFG;
> 
> +retval = modperl_callback_per_dir(MP_CLEANUP_HANDLER, r, 
> + MP_HOOK_RUN_ALL);
> +
>   if (rcfg->pnotes) {
>   SvREFCNT_dec(rcfg->pnotes);
>   rcfg->pnotes = Nullhv;
>   }
> -
> -retval = modperl_callback_per_dir(MP_CLEANUP_HANDLER, r, 
> MP_HOOK_RUN_ALL);
> 
>   /* undo changes to %ENV caused by +SetupEnv, perl-script, or
>* $r->subprocess_env, so the values won't persist  */



-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Problems with configuring mod_perl / apache 1.3.29 and mod ssl -2.8.16-1.3.29

2003-12-20 Thread lwa
Newbie to mod_perl question...thanks in advance for any assistance.

I am experiencing a problem trying to configure mod_perl-1.99_11 with apache
1.3.29 and mod_ssl-2.8.16-1.3.29.

I can sucessfuly configure & build apache & mod ssl without problem, but whe
trying to configure mod perl I get the following error .

# /usr/local/bin/perl Makefile.PL USE_APACI=1 EVERYTHING=1 DO_HTTPD=1
SSL_BASE=/usr/local/ssl\
>  APACHE_PREFIX=/usr/local/apache  APACHE_SRC=../apache_1.3.29/src \
>  APACI_ARGS='--enable-module=ssl,--enable-module=unique_id,\
>  --enable-module=rewrite, --enable-module=proxy, --enable-module=info,\
>  --with-perl=/usr/local/bin/perl, --activate-module=src/modules/gzip/mod_gzip.a'

Reading Makefile.PL args from @ARGV
!!! Unable to determine server version, aborting.
!!! Please specify MP_APXS or MP_AP_PREFIX.



I have tried setting various combinations of MP_APXS or MP_AP_PREFIX without
any sucess... one example below...


# /usr/local/bin/perl Makefile.PL \
APACHE_SRC=../apache_1.3.29/src \
MP_AP_PREFIX=/pub/Apache/apache_1.3.29/src \ 
NO_HTTPD=1 \
USE_APACI=1 \
PREP_HTTPD=1 \
EVERYTHING=1 \
SSL_BASE=/usr/local/ssl \
APACHE_PREFIX=/usr/local/apache \
APACI_ARGS='--enable-module=ssl, --enable-module=unique_id,
--enable-module=rewrite, \
--enable-module=proxy, --enable-module=info,--with-perl=/usr/local/bin/perl, \
--activate-module=src/modules/gzip/mod_gzip.a' 

Reading Makefile.PL args from @ARGV
   MP_AP_PREFIX = /pub/Apache/apache_1.3.29/src
!!! Unable to open /pub/Apache/apache_1.3.29/src/include/ap_release.h: No such
file or directory
!!! Unable to determine server version, aborting.
!!! Invalid MP_AP_PREFIX specified?


perl installed version is 5.8.2 on solaris 8

srcs are in /pub/Apache/ like so..

# ls -al
total 27626
drwxr-xr-x   5 root other512 Dec 20 02:01 .
drwxr-xr-x  32 root root1024 Nov 29 12:48 ..
drwxr-xr-x   8 root other512 Dec 20 02:02 apache_1.3.29
-rw-r--r--   1 root other10455040 Nov 15 23:41 apache_1.3.29.tar
drwxr-xr-x  13 root other512 Dec 20 01:54 mod_perl-1.99_11
-rw-r--r--   1 root other3655680 Nov 29 18:04 mod_perl-1.99_11.tar
drwxr-xr-x  10 root other512 Dec 20 02:01 mod_ssl-2.8.16-1.3.29


Apache and modssl configure fine..output below...and build fine.

 ./configure  --with-apache=../apache_1.3.29 --with-ssl=/usr/local/ssl/ \
--prefix=/usr/local/apache  --with-perl=/usr/local/bin/perl\
--enable-module=unique_id --enable-module=rewrite \
--enable-module=proxy --enable-module=info \
--activate-module=src/modules/gzip/mod_gzip.a> > > > 

Configuring mod_ssl/2.8.16 for Apache/1.3.29
 + Apache location: ../apache_1.3.29 (Version 1.3.29)
 + OpenSSL location: /usr/local/ssl/
 + Auxiliary patch tool: ./etc/patch/patch (local)
 + Applying packages to Apache source tree:
   o Extended API (EAPI)
   o Distribution Documents
   o SSL Module Source
   o SSL Support
   o SSL Configuration Additions
   o SSL Module Documentation
   o Addons
Done: source extension and patches successfully applied.
 
Configuring for Apache, Version 1.3.29
 + using installation path layout: Apache (config.layout)
 + activated gzip module (modules/gzip/mod_gzip.a)
Creating Makefile
Creating Configuration.apaci in src
Creating Makefile in src
 + configured for Solaris 280 platform
 + setting C compiler to gcc
 + setting C pre-processor to gcc -E
 + using "tr [a-z] [A-Z]" to uppercase
 + checking for system header files
 + adding selected modules
o rewrite_module uses ConfigStart/End
  enabling DBM support for mod_rewrite
o ssl_module uses ConfigStart/End
  + SSL interface: mod_ssl/2.8.16
  + SSL interface build type: OBJ
  + SSL interface compatibility: enabled
  + SSL interface experimental code: disabled
  + SSL interface conservative code: disabled
  + SSL interface vendor extensions: disabled
  + SSL interface plugin: Vendor DBM (libc)
  + SSL library path: /usr/local/ssl
  + SSL library version: OpenSSL 0.9.7c 30 Sep 2003
  + SSL library type: installed package (stand-alone)
 + enabling Extended API (EAPI)
 + using builtin Expat
 + checking sizeof various data types
 + doing sanity check on compiler and options
Creating Makefile in src/support
Creating Makefile in src/os/unix
Creating Makefile in src/ap
Creating Makefile in src/main
Creating Makefile in src/lib/expat-lite
Creating Makefile in src/modules/standard
Creating Makefile in src/modules/proxy
Creating Makefile in src/modules/ssl
Creating Makefile in src/modules/gzip
 



Thanks in advance


Lou

-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: introducing new code with no perceived user delays?

2003-12-20 Thread Stas Bekman
Fred Moyer wrote:

looks familiar.  Do I get credit? :)
You obviously do get the credit, but in the contributor logs, not in the text 
itself:
http://perl.apache.org/search/swish.cgi?query=randal&sbm=&submit=search
http://perl.apache.org/about/contributors/other.html#Contributors

I'm not familiar with the protocol regarding credit for the mod_perl
documentation but this updated patch gives credit to the contributors :)
Fred, can you please send in a previous version (no contributor names in the 
text) but as a unified patch, i.e generated with 'diff -u':

  diff -u orig new

See:
http://perl.apache.org/download/docs.html#Submitting_documentation_patches
Thanks.

__
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
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: using pnotes to store/retrieve Class::DBI objects?

2003-12-20 Thread Stas Bekman
Eric J. Hansen wrote:
Hurrah!  Its working now.  Thank you!
Cool. Thanks for the report.

I'll commit it after releasing 1.99_12 on Monday, so it'll be available in 
1.99_13 hopefully somewhere next month. I can't add it to 1.99_12 since it 
wasn't tested.

When I try to retrieve this Class::DBI object from the Cleanup 
Handler, the pnotes values are totally gone.  However, 
regular scalers 

that I've put in 'notes' are still there. Perhaps pnotes has (by 
design) already been cleaned up prior to the 
PerlCleanupHandler stage?

Right, here is the fix:
__
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
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: introducing new code with no perceived user delays?

2003-12-20 Thread Randal L. Schwartz
> "Stas" == Stas Bekman <[EMAIL PROTECTED]> writes:

Stas> You obviously do get the credit, but in the contributor logs, not in
Stas> the text itself:
Stas> http://perl.apache.org/search/swish.cgi?query=randal&sbm=&submit=search
Stas> http://perl.apache.org/about/contributors/other.html#Contributors

Yeah, I was half joking, and I think I even knew I was already in there.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: Problems with configuring mod_perl / apache 1.3.29 and mod ssl -2.8.16-1.3.29

2003-12-20 Thread Stas Bekman
[EMAIL PROTECTED] wrote:
Newbie to mod_perl question...thanks in advance for any assistance.

I am experiencing a problem trying to configure mod_perl-1.99_11 with apache
1.3.29 and mod_ssl-2.8.16-1.3.29.
See: http://perl.apache.org/bugs/

http://perl.apache.org/docs/2.0/user/help/help.html#Wrong_Apache_mod_perl_combination

  Apache 2.0 doesn't work with mod_perl 1.0.
  Apache 1.0 doesn't work with mod_perl 2.0.
__
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
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: VirtualHost + PerlSetVar

2003-12-20 Thread Paul G. Weiss
Great suggestion.  I'll certainly try that.

As to why I expected PerlSetVar to be available during startup, it is 
because that is how it was with mod_perl1, and I wasn't considering the 
fact that configuration in mod_perl2 is a very different animal.  I'll 
pass your suggestion on to the maintainer of Apache::PageKit (that is, if 
he doesn't read this list), because it will affect his documentation.

-Paul

On Fri, 19 Dec 2003 18:32:46 -0800, Stas Bekman <[EMAIL PROTECTED]> wrote:

Paul G. Weiss wrote:
[...]
The reason this is important is that I'm trying to get Apache::PageKit 
to run in virtual hosts, and it depends on the availability of 
PerlSetVar variables on startup.
First of all, why do you expect PerlSetVar to be available at the server 
startup? The config phase is not completed and the value can be 
overriden several times by the end of config.

Second, Apache->server always gives you the global (top-level) server, 
so of course once you move PerlSetVar outside of vhost, you get to see 
its value.

I think using PerlPostConfigHandler will let you achieve what you want:

PerlRequire /var/www/perl/startup.pl
# set value in global scope
PerlSetVar foo global

SetHandler perl-script
PerlHandler Module


# set value in virtual host scope
PerlSetVar foo virtual
PerlModule Module
PerlPostConfigHandler Module::start

package Module;

sub start {
  my($conf_pool, $log_pool, $temp_pool, $s) = @_;
  print "Module->start sees foo=" . $s->dir_config('foo') . "\n";
}
(this code is untested, but I think it should do what you want)

The difference is that you get the correct $s object here (which you 
can't get during the config phase).  Sounds like your case can be a 
useful addition to the existing example:
http://perl.apache.org/docs/2.0/user/handlers/server.html#PerlPostConfigHandler

__
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



--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


directive says no perl handler specified

2003-12-20 Thread Brian Bober
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25175

Running Redhat 9, Apache 2.0.40

This directive is within a virtual host section. I also installed
bundle::openinteract


use lib qw( /var/www/html/thenetdragon/www );


OpenInteract needs this to function properly.

(/etc/httpd/conf.d)> service httpd restart
Stopping httpd:[FAILED]
Starting httpd: Syntax error on line 1087 of /etc/httpd/conf/httpd.conf:
no  handler specified


I tried installing Bundle::Apache through Cpan to solve the problem, but it
wouldn't finish installing... I got errors.



__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: directive says no perl handler specified

2003-12-20 Thread Stas Bekman
Brian Bober wrote:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25175

Running Redhat 9, Apache 2.0.40
See http://perl.apache.org/bugs/

This directive is within a virtual host section. I also installed
bundle::openinteract

use lib qw( /var/www/html/thenetdragon/www );

OpenInteract needs this to function properly.

(/etc/httpd/conf.d)> service httpd restart
Stopping httpd:[FAILED]
Starting httpd: Syntax error on line 1087 of /etc/httpd/conf/httpd.conf:
no  handler specified
I tried installing Bundle::Apache through Cpan to solve the problem, but it
wouldn't finish installing... I got errors.
You need to install the latest modperl, 1.99_11 (1.99_12 will be released on 
Monday).



__
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
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: directive says no perl handler specified

2003-12-20 Thread Chris Winters
This directive is within a virtual host section. I also installed
bundle::openinteract

use lib qw( /var/www/html/thenetdragon/www );

OpenInteract needs this to function properly.
(/etc/httpd/conf.d)> service httpd restart
FWIW, OpenInteract doesn't work with Apache2/mod_perl2, and AFAIK it 
probably won't. OpenInteract2 (now in beta) will work with mod_perl 
versions 1, 2 and other environments as well.

Chris

--
Chris Winters
Creating enterprise-capable snack systems since 1988
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Shared memory broke ;.;

2003-12-20 Thread Daniel Wilson
Moved my site to a new server.

Old Server
  PID USER PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME CPU COMMAND
30056 apache 9   0 10964  10M 10288 S 0.0  0.7   0:00   0 httpd
30057 apache 9   0 10964  10M 10288 S 0.0  0.7   0:00   0 httpd
30058 apache 9   0 10964  10M 10288 S 0.0  0.7   0:00   1 httpd
30059 apache 9   0 10964  10M 10288 S 0.0  0.7   0:00   1 httpd
30060 apache 9   0 10964  10M 10288 S 0.0  0.7   0:00   0 httpd


New Server
  PID USER PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME CPU COMMAND
 2733 apache16   0 12716  12M  3520 S 3.0  2.5   0:00   0 httpd
 2731 apache17   0 12668  12M  3500 S 2.3  2.5   0:00   0 httpd
 2728 apache18   0 11684  11M  3380 S 0.3  2.3   0:00   0 httpd
 2718 apache19   0 12296  12M  3460 S 0.0  2.4   0:00   0 httpd
 2720 apache24   0 12668  12M  3500 S 0.0  2.5   0:00   0 httpd


What the hell happened? Its not sharing the modules at start up and none of
the config or compile options have changed. Its even the same RedHat 9
install. The only thing different is the fact the old server has a custom
SMP kernel and the new has redhat's stock kernel.

Any clues what else it could be? Recompiling the kernel is the last thing i
want to do remotely.

Danni


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: VirtualHost + PerlSetVar

2003-12-20 Thread Paul G. Weiss
Rats!  PerlPostConfigHandler appears to have absolutely no effect when 
placed inside a  scope.  It does indeed run when placed 
outside.  I know this because I have something like:

open(H, ">", "/tmp/output");
print H "something\n"
in my handler and the file written to only when PerlPostConfigHandler is 
outside the  scope.  By the way, this is also true with 
PostOpenLogsHandler.  In fact, when I set

PerlTrace all

in my configuration file, I see the line:

modperl_callback_run_handlers: no PerlPostConfigHandler handlers 
configured ()

in the errors log.

-Paul



On Sat, 20 Dec 2003 16:52:09 -0500, Paul G. Weiss <[EMAIL PROTECTED]> wrote:

Great suggestion.  I'll certainly try that.

As to why I expected PerlSetVar to be available during startup, it is 
because that is how it was with mod_perl1, and I wasn't considering the 
fact that configuration in mod_perl2 is a very different animal.  I'll 
pass your suggestion on to the maintainer of Apache::PageKit (that is, 
if he doesn't read this list), because it will affect his documentation.

-Paul

On Fri, 19 Dec 2003 18:32:46 -0800, Stas Bekman <[EMAIL PROTECTED]> wrote:

Paul G. Weiss wrote:
[...]
The reason this is important is that I'm trying to get Apache::PageKit 
to run in virtual hosts, and it depends on the availability of 
PerlSetVar variables on startup.
First of all, why do you expect PerlSetVar to be available at the 
server startup? The config phase is not completed and the value can be 
overriden several times by the end of config.

Second, Apache->server always gives you the global (top-level) server, 
so of course once you move PerlSetVar outside of vhost, you get to see 
its value.

I think using PerlPostConfigHandler will let you achieve what you want:

PerlRequire /var/www/perl/startup.pl
# set value in global scope
PerlSetVar foo global

SetHandler perl-script
PerlHandler Module


# set value in virtual host scope
PerlSetVar foo virtual
PerlModule Module
PerlPostConfigHandler Module::start

package Module;

sub start {
  my($conf_pool, $log_pool, $temp_pool, $s) = @_;
  print "Module->start sees foo=" . $s->dir_config('foo') . "\n";
}
(this code is untested, but I think it should do what you want)

The difference is that you get the correct $s object here (which you 
can't get during the config phase).  Sounds like your case can be a 
useful addition to the existing example:
http://perl.apache.org/docs/2.0/user/handlers/server.html#PerlPostConfigHandler

__
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




--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html