[ANNOUNCE] Cache::Mmap 0.09

2005-11-16 Thread Peter Haworth
The uploaded file

Cache-Mmap-0.09.tar.gz

has entered CPAN as

  file: $CPAN/authors/id/P/PM/PMH/Cache-Mmap-0.09.tar.gz
  size: 21463 bytes
   md5: fef44673771a0f1f14982ae719f57221

This is a bugfix release, especially for users of operating systems which
enforce mmap()'s specified behaviour of failing to map locked files.

>From the README:

This module provides a shared cache, using a memory mapped file. Very useful
for mod_perl applications. If routines are provided which interact with the
underlying data, access to the cache is completely transparent, and the module
handles all the details of refreshing cache contents, and updating underlying
data, if necessary.

-- 
Peter Haworth   [EMAIL PROTECTED]
``oh sure, that's what Microsoft WANT - but it'd be no good waking up in the
  morning feeling blue and thinking "I did not correctly fall asleep. To
  prevent myself thinking this again I must select sleep from my start menu"''
-- Andrew Feldhaus


Re: Detecting request cancellation behind proxy servers

2005-11-16 Thread Perrin Harkins
On Wed, 2005-11-16 at 10:11 +1000, Badai Aqrandista wrote:
> But I need to know if a request has been cancelled. The problem is that I 
> need to release the session lock when someone click submit button before the 
> page is fully loaded, otherwise the next page won't load because it is 
> waiting for the session lock to be released by the previous process that has 
> been cancelled before releasing it.

Why are you using locking with your sessions?  Are you doing something
that truly requires it?  You already have atomic updates if you use
database-backed session storage.

Consider moving this data out of your session and passing it in URLs
instead.  Consider separating out the slow part of handling this request
into a forked process, so that the session is not locked during the
whole calculation.

In other words, look for a way to avoid the root of the problem: doing a
slow operation and keeping the session locked the whole time.

- Perrin



Undefined Value error

2005-11-16 Thread Brenda Washington
I'm getting this error when running a test in mod_perl. I've looked at the 
httpd.conf file and I can't figure out
what's causing this error, or how to fix it. How do I re-define the value at 
line 2107? 

[Tue Nov 15 14:36:14 2005] [info] 0 APR:: modules loaded
[Tue Nov 15 14:36:14 2005] [info] base server + 27 vhosts ready to run tests
.   (in cleanup) Can't call method "push_handlers" on an undefined 
value at /opt/apache/mod_perl-2.0.1/t/conf/httpd.conf line 2107.
Syntax error on line 2094 of /opt/apache/mod_perl-2.0.1/t/conf/httpd.conf:
\t(in cleanup) Can't call method "push_handlers" on an undefined value at 
/opt/apache/mod_perl-2.0.1/t/conf/httpd.conf line 2107.\n


This is the area in my httpd.conf where the error messages are generated from. 


# APACHE_TEST_CONFIG_ORDER 1000
Listen 0.0.0.0:8561

ServerName localhost:8561
PerlModuleTestHooks::push_handlers_anon

# want to push a handler for a vhost, via $s, but the only way to
# get $s for vhost is to traverse the vhosts list
use Apache::Test;
use Apache::TestRequest;
Apache::TestRequest::module('TestHooks::push_handlers_anon');
my $hostport = Apache::TestRequest::hostport(Apache::Test::config());
my($host, $port) = split ':', $hostport;
my $s = Apache2::ServerUtil->server;
my $vs = $s->next;
for (; $vs; $vs = $vs->next) {
last if $port == $vs->port
}
$vs->push_handlers(PerlFixupHandler =>
   sub { &TestHooks::push_handlers_anon::add_note });
$vs->push_handlers(PerlFixupHandler =>
   \&TestHooks::push_handlers_anon::add_note   );   
 <--- Line 2107 in http.conf file
$vs->push_handlers(PerlFixupHandler =>
   "TestHooks::push_handlers_anon::add_note");

   

SetHandler modperl
PerlResponseHandler TestHooks::push_handlers_anon






Brenda Washington
Unix System Specialist
1401 W. Hwy 421
Westville, Ind. 46360
(219) 785- 5417
[EMAIL PROTECTED]



Re: Undefined Value error

2005-11-16 Thread Philippe M. Chiasson
Brenda Washington wrote:
> I'm getting this error when running a test in mod_perl. I've looked at the 
> httpd.conf file and I can't figure out
> what's causing this error, or how to fix it. How do I re-define the value at 
> line 2107? 
> 
> [Tue Nov 15 14:36:14 2005] [info] 0 APR:: modules loaded
> [Tue Nov 15 14:36:14 2005] [info] base server + 27 vhosts ready to run tests
> .   (in cleanup) Can't call method "push_handlers" on an 
> undefined value at /opt/apache/mod_perl-2.0.1/t/conf/httpd.conf line 2107.
> Syntax error on line 2094 of /opt/apache/mod_perl-2.0.1/t/conf/httpd.conf:
> \t(in cleanup) Can't call method "push_handlers" on an undefined value at 
> /opt/apache/mod_perl-2.0.1/t/conf/httpd.conf line 2107.\n
> 
> This is the area in my httpd.conf where the error messages are generated 
> from. 
>
> # APACHE_TEST_CONFIG_ORDER 1000
> Listen 0.0.0.0:8561
> 
> ServerName localhost:8561
> PerlModuleTestHooks::push_handlers_anon
> 
> # want to push a handler for a vhost, via $s, but the only way to
> # get $s for vhost is to traverse the vhosts list
> use Apache::Test;
> use Apache::TestRequest;
> Apache::TestRequest::module('TestHooks::push_handlers_anon');
> my $hostport = Apache::TestRequest::hostport(Apache::Test::config());
> my($host, $port) = split ':', $hostport;
> my $s = Apache2::ServerUtil->server;
> my $vs = $s->next;
> for (; $vs; $vs = $vs->next) {
> last if $port == $vs->port
> }

Smells like this loops falls through without finding the correct vhost.
Can you dump out $host, $port and the final value of $vs ?


Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5


signature.asc
Description: OpenPGP digital signature


Re: Detecting request cancellation behind proxy servers

2005-11-16 Thread Badai Aqrandista



On Wed, 2005-11-16 at 10:11 +1000, Badai Aqrandista wrote:
> But I need to know if a request has been cancelled. The problem is that 
I
> need to release the session lock when someone click submit button before 
the

> page is fully loaded, otherwise the next page won't load because it is
> waiting for the session lock to be released by the previous process that 
has

> been cancelled before releasing it.

Why are you using locking with your sessions?  Are you doing something
that truly requires it?  You already have atomic updates if you use
database-backed session storage.


Actually, the locking I meant is the Apache::Session's lock. I am guessing 
that A::S lock blocks the second page to be loaded if the first page hasn't 
finished loading.



In other words, look for a way to avoid the root of the problem: doing a
slow operation and keeping the session locked the whole time.


I'll look into that. Thanks...

---
Badai Aqrandista
Cheepy (?)

_
REALESTATE: biggest buy/rent/share listings   
http://ninemsn.realestate.com.au




Re: Detecting request cancellation behind proxy servers

2005-11-16 Thread Perrin Harkins
On Thu, 2005-11-17 at 09:02 +1000, Badai Aqrandista wrote:
> Actually, the locking I meant is the Apache::Session's lock. I am guessing 
> that A::S lock blocks the second page to be loaded if the first page hasn't 
> finished loading.

I know, but you don't have to use that if you are storing the sessions
in a database.  There is a risk of lost updates (i.e. last save wins)
but no risk of data corruption.  So, if what you're storing in the
session can handle the possibility of a later save from the interrupted
page overwriting session data, you don't need the lock.  Look at the
NullLocker class in A::S.

- Perrin



special proxy mp handler

2005-11-16 Thread JT Smith
I'd like to write a handler that would serve big files out of a local cache but proxy 
everything else through to another server. The situation is that there is an extranet in 
the US, but a lot of folks in New Zealand need access to the file downloads. I don't 
want to replicate the whole installation in NZ, but instead, give them a seperate server 
with mod_proxy set up so that when they request most pages it proxies them through from 
the main server, but when they ask for a really big file in the /uploads path that it 
can pull it out of local cache.


Here's what I have so far:

package CacheHandler;

use Apache2::Request;
use Apache2::Const;

sub handler {
my $r = shift;
if ($r->uri =~ m/^\/uploads/) {
my $path = "/data/cache".$r->uri;
if (-f $path) {
   # make it serve up this local file since it exists
}
}
return Apache2::Const::DECLINED;
}

1;

And here's the virtual host I've set up:


ServerName extranet
SSLProxyEngine on
DocumentRoot "/data/cache"
ProxyPass / https://example.com/
PerlModule CacheHandler
PerlInitHandler CacheHandler


What can I add into my handler to make it circumvent the ProxyPass directive? Or if I 
can't do that, how can I tell it to enable ProxyPass on any request where I don't pass 
those other conditions?


Thanks for any assistance you can provide in advance.

JT ~ Plain Black
ph: 703-286-2525 ext. 810
fax: 312-264-5382
http://www.plainblack.com

I reject your reality, and substitute my own. ~ Adam Savage


Re: Undefined Value error

2005-11-16 Thread Philippe M. Chiasson
Philippe M. Chiasson wrote:
> Brenda Washington wrote:
> 
>>I'm getting this error when running a test in mod_perl. I've looked at the 
>>httpd.conf file and I can't figure out
>>what's causing this error, or how to fix it. How do I re-define the value at 
>>line 2107? 

This problem has possibly been fixed in svn by change 345151. If you could get 
the latest svn version and try
again, your problem is most likely gone.

Now, Apache2::ServerUtil->server, when called in a  section, will now
return more logically the server the  block is evaluated into.


Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5


signature.asc
Description: OpenPGP digital signature


Re: special proxy mp handler

2005-11-16 Thread Philippe M. Chiasson
JT Smith wrote:
> I'd like to write a handler that would serve big files out of a local
> cache but proxy everything else through to another server. The situation
> is that there is an extranet in the US, but a lot of folks in New
> Zealand need access to the file downloads. I don't want to replicate the
> whole installation in NZ, but instead, give them a seperate server with
> mod_proxy set up so that when they request most pages it proxies them
> through from the main server, but when they ask for a really big file in
> the /uploads path that it can pull it out of local cache.
> 
> Here's what I have so far:
> 
> package CacheHandler;
> 
> use Apache2::Request;
> use Apache2::Const;
> 
> sub handler {
> my $r = shift;
> if ($r->uri =~ m/^\/uploads/) {
> my $path = "/data/cache".$r->uri;
> if (-f $path) {
># make it serve up this local file since it exists
> }
> }
  else {
  my $real_url = $r->unparsed_uri;
  $r->proxyreq(1);
  $r->uri($real_url);
  $r->filename("proxy:$real_url");
  $r->handler('proxy-server');
  }
> return Apache2::Const::DECLINED;
> }
> 
> 1;

And then you don't need ProxyPass anymore.

See http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_proxyreq_ for
more details

> And here's the virtual host I've set up:
> 
> 
> ServerName extranet
> SSLProxyEngine on
> DocumentRoot "/data/cache"
> ProxyPass / https://example.com/
> PerlModule CacheHandler
> PerlInitHandler CacheHandler
> 
> 
> What can I add into my handler to make it circumvent the ProxyPass
> directive? Or if I can't do that, how can I tell it to enable ProxyPass
> on any request where I don't pass those other conditions?
> 
> Thanks for any assistance you can provide in advance.


Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5


signature.asc
Description: OpenPGP digital signature


Re: special proxy mp handler

2005-11-16 Thread JT Smith

You rock! Thank you very much.


On Wed, 16 Nov 2005 15:58:40 -0800
 "Philippe M. Chiasson" <[EMAIL PROTECTED]> wrote:

JT Smith wrote:

I'd like to write a handler that would serve big files out of a local
cache but proxy everything else through to another server. The situation
is that there is an extranet in the US, but a lot of folks in New
Zealand need access to the file downloads. I don't want to replicate the
whole installation in NZ, but instead, give them a seperate server with
mod_proxy set up so that when they request most pages it proxies them
through from the main server, but when they ask for a really big file in
the /uploads path that it can pull it out of local cache.

Here's what I have so far:

package CacheHandler;

use Apache2::Request;
use Apache2::Const;

sub handler {
my $r = shift;
if ($r->uri =~ m/^\/uploads/) {
my $path = "/data/cache".$r->uri;
if (-f $path) {
   # make it serve up this local file since it exists
}
}

 else {
  my $real_url = $r->unparsed_uri;
 $r->proxyreq(1);
 $r->uri($real_url);
  $r->filename("proxy:$real_url");
 $r->handler('proxy-server');
 }

return Apache2::Const::DECLINED;
}

1;


And then you don't need ProxyPass anymore.

See http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_proxyreq_ for
more details


And here's the virtual host I've set up:


ServerName extranet
SSLProxyEngine on
DocumentRoot "/data/cache"
ProxyPass / https://example.com/
PerlModule CacheHandler
PerlInitHandler CacheHandler


What can I add into my handler to make it circumvent the ProxyPass
directive? Or if I can't do that, how can I tell it to enable ProxyPass
on any request where I don't pass those other conditions?

Thanks for any assistance you can provide in advance.



Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5



JT ~ Plain Black
ph: 703-286-2525 ext. 810
fax: 312-264-5382
http://www.plainblack.com

I reject your reality, and substitute my own. ~ Adam Savage


Preestablish database connection during httpd process startup--HOWTO??

2005-11-16 Thread KartheeK
Hello Everybody,  I am Using a Trouble ticketing System- OTRS it is running on mod_perl, I am trying to configure " Preestablish datababase connections" During httpd process startup: I have configured the "apache2-perl-startup.pl" as follows:  use Apache (); use Apache::DBI (); Apache::DBI->connect_on_init('DBI:mysql:otrs::localhost',"otrs","hot"); use DBI (); use DBD::mysql ();  But, on doing this my httpd server doesn’t start and I get the following error: ERROR---1*** Can't locate Apache.pm in @INC (@INC contains: /opt/otrs/Kernel/cpan-lib /opt/otrs/ /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-mult
 i
 /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4 /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.6/i386-linux-thread-multi /usr/lib/perl5/5.8.6 . /etc/httpd) at /opt/otrs/scripts/apache2-perl-startup.pl line 22.\nBEGIN failed--compilation aborted at /opt/otrs/scripts/apache2-perl-startup.pl line 22.\nCompilation failed in require at (eval 2) line 1.\n [Wed Nov 16 12:03:30 2005] [error] Can't load Perl file: /opt/otrs/scripts/apache2-perl-startup.pl for server mercury.envisionone.net:0, exiting...
 ERROR---1*** Therefore I Included the file Apache.pm From: “/usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi/DBI/ProfileDumper/Apache.pm” To: “/opt/otrs” Now, I get another Error *ERROR---2** [Wed Nov 16 12:13:38 2005] [error] Can't locate Apache/DBI.pm in @INC (@INC contains: /opt/otrs/Kernel/cpan-lib /opt/otrs/ /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi
 /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4 /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.6/i386-linux-thread-multi /usr/lib/perl5/5.8.6 . /etc/httpd) at /opt/otrs/scripts/apache2-perl-startup.pl line 23.\nBEGIN failed--compilation aborted at /opt/otrs/scripts/apache2-perl-startup.pl line 23.\nCompilation failed in require at (eval 2) line 1.\n [Wed Nov 16 12:13:38 2005] [error] Can't load Perl file: /opt/otrs/scripts/apache2-perl-startup.pl for server mercury.envisionone.net:0, exiting... ***ERROR---2** However,  #use Apache (); #use Apache::DBI (); #Apache::DBI->connect_on_init('DBI:mysql:otrs::localhost',"otrs","hot"); use DBI (); use DBD::mysql ();  Works without any problem. 
 Am I
 wrong in the configuration?? Anybody with success in this?     Regards  KartheeK 
		 
Enjoy this Diwali with Y! India Click here