Re: global variable

2010-02-03 Thread Boysenberry Payne
Looks like a great module.
It says early on in the docs that it doesn't use references; does that mean we 
need to dereference in order to store that values?

Thanks,
Boysenberry Payne

On Feb 3, 2010, at 10:17 AM, macke...@animalhead.com wrote:

 I rewrote IPC::MMA from an earlier CPAN module so that I could
 use shared memory among Apache children.  You can read about it at
 http://search.cpan.org/~mackenna/IPC-MMA-0.6/MMA.pod
 
 On Feb 2, 2010, at 9:45 PM, m...@normalperson.e4ward.com wrote:
 
 Hello,
 
 Is there a method to setup a global variable for all modperl child processes?
 Also this variable will be updated sometime, when it get updated, all
 processes will know it.
 
 Thanks.
 



Getting DBI working during the server life cycle

2010-01-23 Thread Boysenberry Payne
Hello,

I'm trying to connect to my postgresql database using the DBI - Apache::CBI - 
DBD::Pg combination of modules.
I'm having trouble understanding Apache::DBI usage as it pertains to https pre 
request server life cycle, in particular during the OpenLogs stage.
My trouble comes from an error I'm getting from DBI:

Global $r object is not available. Set:
PerlOptions +GlobalRequest
in httpd.conf at /usr/local/lib/perl5/site_perl/5.10.1/Apache/DBI.pm line 144.

So, obviously, the Apache::RequestRec object hasn't been globalized because 
it's before the request stage (the child processes haven't even been forked 
yet.)
If I use DBI in my startup.pl file first, no problems, but Apache::DBI says to 
have it load before DBI to use the persistent connections it offers, thus my 
dilemma.

So, what do I do?

-bop



Re: Getting DBI working during the server life cycle

2010-01-23 Thread Boysenberry Payne
I wasn't sure how to do the path mentioned in the link so I just manually 
edited the Apache::DBI file and added the eval around the line requesting 
Apache2::RequestRec and it seems to work now.
Thanks for the heads up.  All of the literature I have mentions Apache::DBI for 
use with mod_perl.
I did look at DBI::Class as the Apache::DBI author mentioned, but I would 
rather use Apache::DBI and do the class structure myself.

Seems like an easy enough thing to patch into Apache::DBI to avoid these head 
aches, wonder why the author isn't?

Thanks again,
Boysenberry Payne

On Jan 23, 2010, at 9:34 PM, Adam Prime wrote:

 Boysenberry Payne wrote:
 Hello,
 I'm trying to connect to my postgresql database using the DBI - Apache::CBI 
 - DBD::Pg combination of modules.
 I'm having trouble understanding Apache::DBI usage as it pertains to https 
 pre request server life cycle, in particular during the OpenLogs stage.
 My trouble comes from an error I'm getting from DBI:
 Global $r object is not available. Set:
  PerlOptions +GlobalRequest
 in httpd.conf at /usr/local/lib/perl5/site_perl/5.10.1/Apache/DBI.pm line 
 144.
 So, obviously, the Apache::RequestRec object hasn't been globalized because 
 it's before the request stage (the child processes haven't even been forked 
 yet.)
 If I use DBI in my startup.pl file first, no problems, but Apache::DBI says 
 to have it load before DBI to use the persistent connections it offers, thus 
 my dilemma.
 So, what do I do?
 
 Don't use Apache::DBI 1.07 and try to do this, because as you've discovered, 
 it's broken.
 
 see: http://rt.cpan.org/Public/Bug/Display.html?id=36346
 
 Adam
 
 



Need an explanation of APR::Pool and it's use in mod_perl

2010-01-17 Thread Boysenberry Payne
Hello everyone,

I've been looking over the APR::Pool because some pools gets passed to some of 
my handlers and I was wondering how I could use it to good effect managing my 
memory better.
There are great instructions on the API for it, but no real explanation as to 
how to use the pool (at least not in the APR::Pool docs.)

I was wondering if anyone could explain how to use memory pools to manage 
memory, or point out some examples I might have missed.

I'm not looking for what's already in the doc, i.e. I already understand what 
is mean by the life cycle of the pool, destroy vs. clear, etc.  I'm looking for 
more of an example of how to use the pool with my memory, i.e. do I have to 
create my data structures in the pool somehow, or is it taken care of 
automagically somehow that isn't obvious?  It seems pretty low level, is it 
something I should avoid, via higher level modules or something like that?

Thank you,
Boysenberry Payne

A question of debugging/testing for when memory goes from shared to unshared

2010-01-17 Thread Boysenberry Payne
Hello Everyone,

After reading Practical mod_perl's section on Improving Performance with Shared 
Memory  and proper forking a bit, I'm wondering if I can setup a means for 
testing what is shared and when it becomes unshared in my memory usage.

I can't seem to currently get GTop installed on my OS X box (I'm sure that will 
get resolved shortly.)

So, I was wondering if anyone has come up with an alternative to determine a 
way of testing or debugging when memory goes from shared to unshared in the 
mod_perl environment?

I notice in my processes (using top) that there are several processes that look 
like they have the same memory maps with regards to shared vs. unshared memory, 
then there is the root, and one child that has it's one shared and unshared 
memory allotment. It usually starts with less shared memory than the rest, but 
on every restart the memory usages change so that the shared amounts change 
with each restart, sometimes higher, sometimes lower.

I'm wondering if there is a way to see under the hood so to speak to determine 
what is being shared and what is not in each child process.
Obviously, single user mode type debugging is out.

Any suggestions?

Thank you,
 Boysenberry Payne

Caveats to using Perl Sections for server configuration?

2010-01-13 Thread Boysenberry Payne
I'm using Perl blocks in my apache conf files for early server configuration.
I remember reading someone on this list saying they wouldn't use Perl Sections 
at all.
The main reason I chose to use them to initialize some of my server 
configuration was to allow for relative addressing to the .conf file rather 
than the apache root via the __FILE__ variable.
That allows me to load my perl startup.pl files on different servers regardless 
of where they're stored by keeping them arranged relative to the .conf file 
loading them.

Up to now I've kept what I've done in the Perl Sections limited to manipulating 
@INC and @PerlConfig.
I tried using a couple of perl modules that used 'our' type scopes and they all 
bombed out saying Perl Sections couldn't add the variable, e.g. it chokes on 
File::chdir's $CWD variable.
It does seem to use packages correctly, that in turn become available afterword 
in the symbol tables.

So while the documentation for the Perl Sections was adequate enough to get 
what I needed accomplished, it's left me hungry for more info on what's going 
on behind the scenes.

Before I go and dig around in the source (which I plan on doing,) I was 
wondering if anyone mind sharing the experience and insights on Perl Sections, 
pros cons, etc.

i.e. I'm referring to Perl/Perl blocks in apache .conf files.

Thank you,
Boysenberry Payne



Re: Caveats to using Perl Sections for server configuration?

2010-01-13 Thread Boysenberry Payne
Do you know if the scope of Perl Sections are the same as when using a 
startup.pl?

-bop

On Jan 13, 2010, at 2:15 PM, Perrin Harkins wrote:

 On Wed, Jan 13, 2010 at 3:22 PM, Boysenberry Payne
 boysenbe...@habitatlife.com wrote:
 I'm using Perl blocks in my apache conf files for early server 
 configuration.
 I remember reading someone on this list saying they wouldn't use Perl 
 Sections at all.
 
 That might have been me.  I don't like to use them.  I find it simpler
 to put all the perl code in a startup.pl.  I also like to generate my
 httpd.conf from templates, and this means I can also generate conf
 files for non-mod_perl servers, like my proxy.
 
 - Perrin



Re: a mp/perl equivalent to sendmail.php?

2008-01-30 Thread Boysenberry Payne
I would suggest looking into the Email set of modules, e.g.  
Email::Simple.


As far as security is concerned, try something like an email address
confirmation with user authentication.  I think that's the most  
common approach.


For example, require the user confirms their email address as a part  
of user authentication
before they're allowed to email.  That will keep spam bots out.  If  
you only have a limited
user base, you could skip the email confirmation and just keep a flat  
file or database

records of allowed users.

-bop

On Jan 28, 2008, at 5:19 PM, Carl Brewer wrote:



I have a client who wants to send email from a flash script (do you  
call flash stuff scripts?), and he has asked me to install  
sendmail.php for him.  I don't want to!  Can anyone here recommend  
a modperl (or just plain perl) equivalent that I can lock down so  
it is less likely to be used as a spam delivery agent?


Thanks!

Carl






Re: help with rewriting CGI

2007-12-30 Thread Boysenberry Payne
Once complete, I can preload the modules at Apache startup.  Is  
that correct?



If you want to benefit from pre compiling your code using something  
like a startup.pl file to load the modules

you use would speed things up considerably from running them as CGI cgi.

I use 2 files one for 3rd party modules and one for my own with it's  
own include path.


Also, I may want to use ajax, therefore, what modules will I need  
to run Apache2::Ajax?


Ajax is a client side technology.  You would use whatever you're  
using now, only
running your cgi as mod_perl scripts instead, e.g. if you use CGI.pm  
to process
ajax requests currently, you might want to look into the APR modules  
as replacements for

acquiring your request data.
http://httpd.apache.org/apreq/docs/libapreq2/modules.html

Also keep in mind using mod_perl over standard cgi scripts gives you  
a larger apache life cycle,
i.e. some scripts might be better off applied as filters rather than  
during the response phase.


http://perl.apache.org/docs/2.0/user/handlers/ 
http.html#PerlResponseHandler
http://perl.apache.org/docs/2.0/user/handlers/ 
filters.html#HTTP_Request_Versus_Connection_Filters


Hope that helps.

-bop

On Dec 30, 2007, at 9:10 AM, Raful Mr Mitchell H wrote:

I have a site that is written with traditional CGI (no cgi.pm ).  I  
use mod_perl2 but rather than run the scripts as CGI I want to  
convert them to mod_perl.  I have read Beckman's latest on mod_perl  
2 and have Practical Mod_Perl.


Here's the question.  From what I have read, it looks like I should  
re-write my perl scripts as perl modules and make the appropriate  
changes, such as using $r inside handlers, etc.  Once complete, I  
can preload the modules at Apache startup.  Is that correct?  Also,  
I may want to use ajax, therefore, what modules will I need to run  
Apache2::Ajax?


Thanks,

Mitch
Mitchell Raful MCSE CCNP
MCB Quantico
Personal and Family Readiness (MRI)
3044 Catlin Avenue
Quantico, VA 22134
Com: 703-784-5991
DSN: 278-5991
Cell: 804-363-0731






Re: Cookie questions

2007-12-24 Thread Boysenberry Payne

This is what I do:

$cookie = { name = foo, value = bar }
my $data = [];
push( @$data, Apache2::Cookie-new( $r, %{$cookie} ) );
foreach ( @$data ) {
$_-bake( $r );
}

Hope it helps...

-bop

On Dec 24, 2007, at 2:55 AM, Raymond Wan wrote:



Hi all,

Sorry, but I'm not entirely sure if this is relevant to modperl...

I was wondering if it was possible to delete cookies.  I read that  
using Javascript, cookies can be deleted by setting it to a time in  
the past.  I'm not sure how to do it in Mason, though.  I think I  
know how to get a cookie and also to set a new one and send it  
out.  But, I don't know how to get an old cookie, change it, and  
send it back.  Or even, get a cookie, *copy it*, send the copy  
back.  What is stopping the browser from creating a second cookie  
with the same name?


Also, I've seen various ways of setting cookies.  For example, one  
using APR::Request::Cookie and another using Apache2::Cookie.   
Which should I use?  I'm setting a cookie by doing:


$r-err_headers_out-add (Set-Cookie = $cookie-as_string);

where $cookie is of type APR::Request::Cookie.  Is this strange?   
(I forgot what I read to come up with this...most other documents  
mention a bake method...)


Ray






Re: Cookie questions

2007-12-24 Thread Boysenberry Payne

Oops, I forgot the some code:

# to set
$cookie = { -name = foo, -value = bar, -path = / };
my $data = [];
push( @$cookie_data, Apache2::Cookie-new( $r, %{$cookie} ) );
foreach ( @$cookie_data ) {
$_-bake( $r );
}

# now to unset
my $jar = Apache2::Cookie::Jar-new( $r );
my $cookies = $jar-cookies;
if ( defined $cookies-{foo} ) {
	$cookie = { -name = foo, -value = bar, -path = /, -expires  
= 0 };

push( @$cookie_data, Apache2::Cookie-new( $r, %{$cookie} ) );
foreach ( @$cookie_data ) {
$_-bake( $r );
}
}


On Dec 24, 2007, at 3:29 AM, Boysenberry Payne wrote:


This is what I do:

$cookie = { name = foo, value = bar }
my $data = [];
push( @$data, Apache2::Cookie-new( $r, %{$cookie} ) );
foreach ( @$data ) {
$_-bake( $r );
}

Hope it helps...

-bop

On Dec 24, 2007, at 2:55 AM, Raymond Wan wrote:



Hi all,

Sorry, but I'm not entirely sure if this is relevant to modperl...

I was wondering if it was possible to delete cookies.  I read that  
using Javascript, cookies can be deleted by setting it to a time  
in the past.  I'm not sure how to do it in Mason, though.  I think  
I know how to get a cookie and also to set a new one and send it  
out.  But, I don't know how to get an old cookie, change it, and  
send it back.  Or even, get a cookie, *copy it*, send the copy  
back.  What is stopping the browser from creating a second cookie  
with the same name?


Also, I've seen various ways of setting cookies.  For example, one  
using APR::Request::Cookie and another using Apache2::Cookie.   
Which should I use?  I'm setting a cookie by doing:


$r-err_headers_out-add (Set-Cookie = $cookie-as_string);

where $cookie is of type APR::Request::Cookie.  Is this strange?   
(I forgot what I read to come up with this...most other documents  
mention a bake method...)


Ray








Find the values of Apache2::Const

2007-12-22 Thread Boysenberry Payne

I found that $r-status() required something other than Apache2::Const
in one of my modules and it got me wondering what the Constant values
actually were.  Now I could go through and print each one I suppose,  
but I

thought looking at them in Apache2::Const.pm would be better, but the
package seems to be mostly pod notation.  How can I look up the  
constants,

i.e. where are they?

PS Happy Holidays Everyone...

Thanks,
Boysenberry Payne


Re: Find the values of Apache2::Const

2007-12-22 Thread Boysenberry Payne
I only ask because I tried a $r-status(Apache2::Const::OK) and got a  
500 returned in the header

even though my handler returned with Apache::Const::OK also...

To avoid the 500 header I had to do $r-status(200);  I imagine the  
status code isn't going to change

too soon, so I ought to be okay, right?

This isn't exactly a list of them, but it might point you in the  
right direction.  They're buried pretty well, it seems.


Yeah, I figured it was in c, I stopped at the XSLoader.pm package

Thanks,
Boysenberry


On Dec 22, 2007, at 10:29 AM, Colin Wetherbee wrote:


Boysenberry Payne wrote:
I found that $r-status() required something other than  
Apache2::Const

in one of my modules and it got me wondering what the Constant values
actually were.  Now I could go through and print each one I  
suppose, but I

thought looking at them in Apache2::Const.pm would be better, but the
package seems to be mostly pod notation.  How can I look up the  
constants,

i.e. where are they?


This isn't exactly a list of them, but it might point you in the  
right direction.  They're buried pretty well, it seems.


http://stuff.mit.edu/afs/sipb/service/httpd/src/mod_perl-2.0.1/src/ 
modules/perl/modperl_constants.c


(Also http://tinyurl.com/32y54e)

Colin




Re: Find the values of Apache2::Const

2007-12-22 Thread Boysenberry Payne

When you print Apache2::Const::OK do you get 200?

I'm including it using:
use Apache2::Const -compile = qw( OK REDIRECT FORBIDDEN  
REMOTE_DOUBLE_REV );


I get 0.  I get the correct codes for others like FORBIDDEN, etc.  Go  
figure...


I think what I should have used was HTTP_OK, that seems to return 200...


-bop

On Dec 22, 2007, at 10:45 AM, Colin Wetherbee wrote:


Boysenberry Payne wrote:

I only ask because I tried a $r-status(Apache2::Const::OK) and got a
 500 returned in the header even though my handler returned with
Apache::Const::OK also...
To avoid the 500 header I had to do $r-status(200);  I imagine  
the status code isn't going to change too soon, so I ought to be  
okay,

right?


The HTTP/1.1 status codes are defined in RFC 2616 [0], section  
6.1.1.  I doubt they will change any time soon, so it should be  
fine to use the numbers.


However, if your constants aren't working like they should, it's  
probably worth figuring out why.


I always include my constants with the following line.  Deviating  
from this specific syntax always seems to break stuff for me.


use Apache2::Const -compile = qw(:common);

Colin

[0] http://www.faqs.org/rfcs/rfc2616.html




Re: Flex

2007-12-04 Thread Boysenberry Payne

Then, you can see the html version at:
http://www.habitatlife.com/habitat_html/

The html version is mostly for search engines, but it still gives a  
pretty accurate
example of the site.  The version you see with javascript off is much  
the same, but

the javascript menus don't work visually.

-bop



On Dec 4, 2007, at 7:43 AM, Octavian Rasnita wrote:

Hmm, I have Javascript and cookies enabled, but I don't think I  
have Flash because it wouldn't be very accessible anyway.


Octavian
- Original Message -
From: Boysenberry Payne
To: Octavian Rasnita
Cc: modperl List
Sent: Tuesday, December 04, 2007 9:45 AM
Subject: Re: Flex

It requires javascript, cookies and flashplayer 8+ to view it as  
its intended.

I just checked it out with IE 7 with no problems.

Are you being redirected to here:
http://habitatlife.com/habitat/habitat_website_builder_and_host/

If at the end of the day you still can't see it in IE you can  
always use another browser.

It works in most common browsers.

Our site does use a proxy, are you behind some kind of firewall  
that might prevent proxies?


If its not one of these I'd like to allow you to see it, if for no  
other reason than to make sure

our site works as well as possible.

There are other Habitat sites you can check out too, but if it  
doesn't work at the above

address chances are it wont work at the others too.

(As far as logging in goes, you'd need a log in, which isn't  
provided here...)


-bop


On Dec 4, 2007, at 12:15 AM, Octavian Rasnita wrote:


From: Boysenberry Payne

 I currently use the ruby gem sprouts for compiling Flex apps.  I  
would love to see a version
 packaged for a mod_perl system.  It really is all about learning  
what makes the flex compiler
 work then strapping to perl instead of php or ruby.  I would  
love to help with a project like this

 but don't have the resources to take point.

 Our website builder is completely mod_perl on the backend and  
uses Flash on the front/middle.

 We also have html output too:
 http://www.habitatlife.com/

I have visited and tried the sign in link, but the following  
message appeared:



This site requires Javascript to be work correctly.
Please enable Javascript in your browser or use a Javascript  
capable browser, then reload the site.



Well, I use IE, and Javascript is enabled.
Isn't that web page accessible for screen readers?

Octavian








Re: Flex

2007-12-03 Thread Boysenberry Payne
I currently use the ruby gem sprouts for compiling Flex apps.  I  
would love to see a version
packaged for a mod_perl system.  It really is all about learning what  
makes the flex compiler
work then strapping to perl instead of php or ruby.  I would love to  
help with a project like this

but don't have the resources to take point.

Our website builder is completely mod_perl on the backend and uses  
Flash on the front/middle.

We also have html output too:
http://www.habitatlife.com/

Our system could benefit a lot from being able to compile SWFs on the  
fly; right now they're all
static files loaded dynamically.  I could see making them dynamically  
as needed, while still serving

up the static renditions.

-bop


On Dec 2, 2007, at 5:45 PM, Will Fould wrote:

So, we're using Flex now for a couple neat tools that started as an  
(real simple) experiment with some feeds we produce.  I'm sure a  
lot of other front end developers are too and just don't realize  
that they are connecting to modperl backends. Subtle details aside,  
Flex is cool at this point for limited stuff (think admin and site  
builder/configuration tools, etc.). Especially with the ubiquity of  
the flash RTE and the buzz around AIR.  But we also use Ajax quite  
a bit and like that too.


For those that have not updated their buzzword file lately: Flex is  
a client application building platform that connects easily to  
services - The Flex sdk, etc., (yes, from Adobe) have recently been  
open-sourced (ala Mozilla).  At first glance, Flex appears to be  
just Flash (using .swf files and the flash RTE) but it does not  
require the backwards animation-style dev-metaphor of flash - It's  
basically a very different game all together and there is a lot of  
documentation out there about what makes it different. (Google:  
Flex verses Flash)


At this point, in no way will Flex applications substitute core web/ 
browser stuff for us (or even some browser stuff that work very  
well and simply with ajax), but it does make a lot of sense in  
certain key places where a browser is still quite kludgey.   
Frankly, it's also nice for recruiting right now (Perrin: Looking  
for a new job?  LOL.)


In any case, it would be nice to see more traction using modperl 
+Flex.  While it makes a lot of sense from where I sit - it's true:  
Google provides virtual no pages that share those key words - a sad  
and curious surprise especially considering the fact the O'Reilly  
Flex book has actually reached the popularity of the Perl DBI book  
(according to the O'Reilly amazon rep).  Perhaps a page on the  
Flex.org site would do a LOT of good for this community which is  
certainly much larger than the Perl Marketing department  
indicates ; ).


Any other reference sites or tools?


On Dec 2, 2007 3:06 PM, Perrin Harkins [EMAIL PROTECTED] wrote:
On Dec 1, 2007 3:22 PM, Will Fould [EMAIL PROTECTED] wrote:
 Have you thought about it too?

Yes.  It sounds possibly quicker than AJAX, which is pretty
time-consuming to develop for anything non-trivial.  (Google makes it
look easy, but they probably spent millions debugging those maps on
multiple browsers.)  I haven't tried it, but my approach would be to
convert one of the PHP examples.

- Perrin





Re: Flex

2007-12-03 Thread Boysenberry Payne
It requires javascript, cookies and flashplayer 8+ to view it as its  
intended.

I just checked it out with IE 7 with no problems.

Are you being redirected to here:
http://habitatlife.com/habitat/habitat_website_builder_and_host/

If at the end of the day you still can't see it in IE you can always  
use another browser.

It works in most common browsers.

Our site does use a proxy, are you behind some kind of firewall that  
might prevent proxies?


If its not one of these I'd like to allow you to see it, if for no  
other reason than to make sure

our site works as well as possible.

There are other Habitat sites you can check out too, but if it  
doesn't work at the above

address chances are it wont work at the others too.

(As far as logging in goes, you'd need a log in, which isn't provided  
here...)


-bop


On Dec 4, 2007, at 12:15 AM, Octavian Rasnita wrote:


From: Boysenberry Payne

 I currently use the ruby gem sprouts for compiling Flex apps.  I  
would love to see a version
 packaged for a mod_perl system.  It really is all about learning  
what makes the flex compiler
 work then strapping to perl instead of php or ruby.  I would love  
to help with a project like this

 but don't have the resources to take point.

 Our website builder is completely mod_perl on the backend and  
uses Flash on the front/middle.

 We also have html output too:
 http://www.habitatlife.com/

I have visited and tried the sign in link, but the following  
message appeared:



This site requires Javascript to be work correctly.
Please enable Javascript in your browser or use a Javascript  
capable browser, then reload the site.



Well, I use IE, and Javascript is enabled.
Isn't that web page accessible for screen readers?

Octavian





Re: A question about the post_config phase mod_perl handler

2007-11-13 Thread Boysenberry Payne
Ah, I thought it might be something like that, so anything other than  
0 or OK, got it, thanks...


-bop

On Nov 12, 2007, at 11:33 PM, Philippe M. Chiasson wrote:


Boysenberry Payne wrote:

Interesting, I tried just returning and several other non-OK returns
and got no error.


Interesting, I supect the only thing that bails it out are error  
status in

the 400-500 range then.

Turns out it's a MP_HOOK_RUN_ALL (http://perl.apache.org/docs/2.0/ 
user/handlers/intro.html#C_RUN_ALL_)


And from the docs:

Handlers of the type RUN_ALL will be executed in the order they  
have been registered
until the first handler that returns something other than  
Apache2::Const::OK or Apache2::Const::DECLINED.


Reason this is hapenning is the only valid return code is  
Apache2::Const::OK,
but that also happens to be '0', so returning undef gets converted  
to 0 when

looked at in numeric context, and it OK.

Anything elss will trigger the error I mentionned.

--
Philippe M. Chiasson GPG: F9BFE0C2480E7680 1AE53631CB32A107  
88C3A5A5
http://gozer.ectoplasm.org/   m/gozer\@(apache|cpan|ectoplasm) 
\.org/






Re: A question about the post_config phase mod_perl handler

2007-11-12 Thread Boysenberry Payne
Interesting, I tried just returning and several other non-OK returns  
and got no error.


Here is a sample of what I tried:

In httpd.conf:

PerlPostConfigHandler   MyModule::PostConfig


package MyModule::PostConfig;
use strict;
use warnings;

# Apache2 Post Config Hook Phase Handler
sub handler {
my ($conf_pool, $log_pool, $temp_pool, $s) = @_;
return;
}
1;


No error, runs as far as I can tell just the same as when I return  
Apache2::Const::OK.


I'm running Apache/2.2.3 and mod_perl/2.0.2 on OS X 10.4.10.

-bop

On Nov 12, 2007, at 5:10 PM, Philippe M. Chiasson wrote:


Boysenberry Payne wrote:

In the example at:
http://perl.apache.org/docs/2.0/user/handlers/
server.html#C_PerlPostConfigHandler_

the PerlPostConfigHandler subroutine returns Apache2::Const::OK.

I was wondering if it mattered what it returned, and if so, what are
the alternatives?


It matters, only OK is a valid return value from that stage.  
Otherwise,

you'll get this helpfull error message:

[error] Callback 'MyCallback' returned 404, whereas  
Apache2::Const::OK (0) is the only valid return value for  
PerlPostConfigHandler handlers


--
Philippe M. Chiasson GPG: F9BFE0C2480E7680 1AE53631CB32A107  
88C3A5A5
http://gozer.ectoplasm.org/   m/gozer\@(apache|cpan|ectoplasm) 
\.org/






Re: mod_perl2 and Apache::SharedMem

2007-11-08 Thread Boysenberry Payne


On Nov 8, 2007, at 12:31 AM, Octavian Rasnita wrote:


Hi,

Can you please tell me when the server forks?


As indicated here:
http://perl.apache.org/docs/2.0/user/handlers/server.html

Basically, the server starts then parses the configuration script  
(all pre mod_perl).
The fist phase we have access to with mod_perl is the  
PerlOpenLogsHandler
phase.  Then comes the PerlPostConfigHandler, the last phase before  
the child

processes get spawned.  Then you have the PerlChildInitHandler phase run
at the beginning of every child spawned by the server, run only once  
per child
process.  These and the final PerlChildExitHandler phase (run once  
the child is exiting)

are all server level phases.


What should I do to load some classes before the server forks?


If I'm not mistaken the earliest you can affect a change in the  
server is in any
startup.pl type files.  They will be run during the configuration  
parse.  The first
handler phase PerlOpenLogsHandler is run after this.  It was  
suggested you wait until
the PerlPostConfigHandler phase if you want to load or construct  
stuff on
the server level (parent server).  It will have the structures you  
included in
your startup.pl file available, so tends to be more useful for  
running scripts.



What should I do if I want to load the classes after the server forks?


There are many phases after the fork, the most commonly used is the
PerlResponseHandler phase:

http://perl.apache.org/docs/2.0/user/handlers/ 
http.html#PerlResponseHandler


ANy of the phases mentioned on that page will be post fork.

Hope that helps...



Thank you for clarifications.

Octavian

- Original Message - From: Perrin Harkins [EMAIL PROTECTED]
To: Boysenberry Payne [EMAIL PROTECTED]
Cc: modperl List modperl@perl.apache.org
Sent: Thursday, November 08, 2007 1:04 AM
Subject: Re: mod_perl2 and Apache::SharedMem


On Nov 7, 2007 5:50 PM, Boysenberry Payne  
[EMAIL PROTECTED] wrote:

If I created some of my static hashes and objects during the
PerlPostConfigHandler phase
and added them to either the configuration or log pools


You're missing the big picture.  Adding perl objects to a shared
memory pool doesn't prevent them also needing to be in perl's own
allocated memory pool.  All shared memory schemes with perl result in
MORE memory being used, because every process that accesses these
structures needs its own copy in its own process in addition to the
shared one.  The shared memory one is a serialized perl structure,
created with something like Storable and perl has to turn it back  
into

a normal perl variable, in non-shared memory, in order to use it.

You can't use less memory by sharing your perl data with user-level
shared memory techniques.  Only copy-on-write can help with that.


I have classes that create singleton objects with lots of static
parts.  Should I build these constructs
on server post config so they're already built in the child  
processes

as shared memory rather than
building them in each child, increasing the non-shared memory use?


Build them before the server forks if you use prefork.


Would it allow me to reduce what I have set for
$Apache2::SizeLimit::MAX_UNSHARED_SIZE?


You shouldn't be using that at all unless you have Linux::Smaps
installed, but if you do, loading things before forking should  
improve

the amount of copy-on-write sharing.

- Perrin






Re: mod_perl2 and Apache::SharedMem

2007-11-08 Thread Boysenberry Payne


On Nov 8, 2007, at 1:07 PM, Octavian Rasnita wrote:


From: Boysenberry Payne [EMAIL PROTECTED]
What should I do if I want to load the classes after the server  
forks?


There are many phases after the fork, the most commonly used is the
PerlResponseHandler phase


Do I understand correctly that even the modules specified in  
httpd.conf with


PerlResponseHandler Module::Name

are loaded before the server forks, because they are loaded with
PerlModule Module::Name
or in a startup.pl file?


Correct.  Using `PerlModule Module::Name` in the httpd.conf file is  
the same as
`use Module::Name();`in the startup.pl file.  All of the  
configurations in those files

are run before the fork and before any other accessible phases.


But what if the module Module::Name use or require other modules?
Are they also loaded before the server forks, or I need to load  
them with PerlModule ... in httpd.conf?


Good question.  I think it might depend on how the requires/uses are  
scoped
in the scripts that are included.  I'm pretty sure any use statements  
that are
scoped globally will be included in each forked copy of the server.   
To insure
they are included it is suggested you add your use statements to the  
startup.pl
file.  Probably including your use/require statements in a BEGIN {}  
block will

help to insure they are pre-compiled.

-bop


A question about the post_config phase mod_perl handler

2007-11-08 Thread Boysenberry Payne

In the example at:
http://perl.apache.org/docs/2.0/user/handlers/ 
server.html#C_PerlPostConfigHandler_


the PerlPostConfigHandler subroutine returns Apache2::Const::OK.

I was wondering if it mattered what it returned, and if so, what are  
the alternatives?


Just curious really...

-bop 


Re: mod_perl2 and Apache::SharedMem

2007-11-07 Thread Boysenberry Payne


On Nov 7, 2007, at 11:59 AM, Michael Peters wrote:


Boysenberry Payne wrote:

Is Apache::SharedMem working with mod_perl2 the same way it did  
with

mod_perl1?


Don't know, haven't used it. It hasn't been updated since 2001, so  
either it's

perfect and hasn't needed any changes or it's not being maintained.


Yeah, that's why I asked...




Is Apache::SharedMem the preferred way to handle sharing memory
between apache children?


It's definitely not preferred, but I'm not sure what is. It  
depends on what
you're doing with the data and how often it changes. If it's static  
you can just
load the data at startup in a Perl module. If it changes a lot you  
can use BDB.
If it's something that needs to be shared by multiple machines then  
use
something external like MySQL. If it's just some cached data then  
use something

like memcached or Cache::FastMmap.


Does memcached or Cache::FastMap work with apache's shared memory pool?

I'm basically trying to organize my references along 3 lines:
-   runtime data dumped with each request
-   per child data sticks around as long as the apache child exists
-	apache shared data sticks around for the life of the root apache  
process


I'm sure there are other memory areas to deal with, but those are my  
primary concerns.


I'm looking for a way to control where my references point to in memory.

For example, a already have startup.pl file included in apache's root  
httpd.conf

in the form of:

in the httpd.conf file:
snip
# Startup file for loading assets into memory
PerlRequire /directory/to/startup.pl
/snip

and in the startup.pl file:
snip
#!/usr/bin/perl

BEGIN {
use lib qw(/directory/to/perl_mods);
}

use Apache::DBI ();
...(many more too)...
1;
/snip

In this situation if its possible (which it should be for my own  
modules) I would like
the package symbol table and contents to be loaded into the shared  
server wide memory.


How could I insure the packages aren't loaded into each child process?

If a package is loaded into shared memory is our and my handled  
the same as they are

when its loaded into the apache child process memory?



Are modules loaded using use ModuleName; in an apache startup.pl  
file

loaded into shared memory
or copied to each child separately?


There's nothing special about use. require would work just as  
well. The
thing to remember is that you need to load the Perl modules into  
the Apache
process's memory before it forks. Anything loaded before the fork  
will be shared

(as long as it doesn't change) with Copy-On-Write.


I'm sure I've read about Copy-On-Write, better safe than sorry, have  
any links you can
point me at that will allow me to understand it better?  I want to  
make sure if I write
I don't copy unless I'm sure that's what I need to do (like for  
temporary runtime changes.)


Thanks,
-bop




mod_perl2 and Apache::SharedMem

2007-11-07 Thread Boysenberry Payne
I'm trying to spread my pre apache child memory load appropriately  
and have a few questions.


Is Apache::SharedMem working with mod_perl2 the same way it did  
with mod_perl1?


Is Apache::SharedMem the preferred way to handle sharing memory  
between apache children?


Are modules loaded using use ModuleName; in an apache startup.pl  
file loaded into shared memory

or copied to each child separately?

Thanks,
Boysenberry Payne


Re: mod_perl2 and Apache::SharedMem

2007-11-07 Thread Boysenberry Payne
Other than for callbacks on destruction of memory pools what is  
APR::Pool useful for?


-bop

On Nov 7, 2007, at 1:56 PM, Perrin Harkins wrote:


Don't use Apache::SharedMem.  It uses IPC::ShareLite, which is slow.

Does memcached or Cache::FastMap work with apache's shared memory  
pool?


No, I don't think anyone has ever gotten that to work.


In this situation if its possible (which it should be for my own
modules) I would like
the package symbol table and contents to be loaded into the shared
server wide memory.


It's not possible.  Perl allocates its own memory.  You can't tell it
where it to put things.  As discussed many times on the list,
copy-on-write helps with this on prefork systems.  On threaded
systems, Perl shares the parsed code, but the symbol table is
duplicated for each thread, so it ends up using more memory than
prefork.

You can read more about copy-on-write in the mod_perl docs or at
modperlbook.org and there is more discussion about threads and how
they affect memory in the list archives.

- Perrin




Re: mod_perl2 and Apache::SharedMem

2007-11-07 Thread Boysenberry Payne
If I created some of my static hashes and objects during the  
PerlPostConfigHandler phase
and added them to either the configuration or log pools would that  
help me keep
some of my memory shared, assuming I could get at either pool during  
the PerlResponseHandler?


Am I confusing lifetime scope with shared memory?  Are the two entwined?

I have classes that create singleton objects with lots of static  
parts.  Should I build these constructs
on server post config so they're already built in the child processes  
as shared memory rather than

building them in each child, increasing the non-shared memory use?

Would it allow me to reduce what I have set for  
$Apache2::SizeLimit::MAX_UNSHARED_SIZE?


Thanks for all of the help,
-bop



On Nov 7, 2007, at 2:16 PM, Boysenberry Payne wrote:

Other than for callbacks on destruction of memory pools what is  
APR::Pool useful for?


-bop

On Nov 7, 2007, at 1:56 PM, Perrin Harkins wrote:


Don't use Apache::SharedMem.  It uses IPC::ShareLite, which is slow.

Does memcached or Cache::FastMap work with apache's shared memory  
pool?


No, I don't think anyone has ever gotten that to work.


In this situation if its possible (which it should be for my own
modules) I would like
the package symbol table and contents to be loaded into the shared
server wide memory.


It's not possible.  Perl allocates its own memory.  You can't tell it
where it to put things.  As discussed many times on the list,
copy-on-write helps with this on prefork systems.  On threaded
systems, Perl shares the parsed code, but the symbol table is
duplicated for each thread, so it ends up using more memory than
prefork.

You can read more about copy-on-write in the mod_perl docs or at
modperlbook.org and there is more discussion about threads and how
they affect memory in the list archives.

- Perrin






Re: mod_perl2 and Apache::SharedMem

2007-11-07 Thread Boysenberry Payne


On Nov 7, 2007, at 5:05 PM, Michael Peters wrote:


Boysenberry Payne wrote:

If I created some of my static hashes and objects during the
PerlPostConfigHandler phase
and added them to either the configuration or log pools would that  
help

me keep
some of my memory shared, assuming I could get at either pool  
during the

PerlResponseHandler?


I think you're overthinking it here and getting yourself confused.


After being up for 36+ hours that's an understatement.


I have classes that create singleton objects with lots of static  
parts.

Should I build these constructs
on server post config so they're already built in the child  
processes as

shared memory rather than
building them in each child, increasing the non-shared memory use?


This is how this is typically done:

# in startup.pl
use My::Constructs;

# in My/Constructs.pm
package My::Constructs;
our @data = ();
# do something to build out your data structure...


Then in your application you can just access the data as
@My::Constructs::data and it will be shared by all your child  
processes

(assuming you don't modify it during a request).


Ah, passing constructs directly, I've been trying to figure out that  
for a while.
Can I do that using strict, or do I have to delimit it around the  
reference?

I remember getting errors when I tried that before.

-bop





Re: ANNOUNCE: XS-based minifiers for JS/CSS

2007-10-21 Thread Boysenberry Payne
I generate my Javascript on the fly, it can be different on every  
request.

I find this very useful...

-bop

On Oct 21, 2007, at 11:26 PM, Andrew Wyllie wrote:



Maybe I wasn't really very clear.  I don't think 'minifing' your JS/ 
CSS
every time it's requested is very useful.  You should either  
preprocess it
and then install it on the webserver (in which case you would not  
need a
mod_perl module) OR you could use a mod_perl module that minifies  
the JS/CSS code
if it changes, caching the result to use for subsequent requests.   
It seems like
a bit waste of cycles to minify every time the file is requested,  
and worrying

about the speed of minification seems unnecessary.

Andrew


- Original Message -
From: John ORourke [EMAIL PROTECTED]
To: modperl List modperl@perl.apache.org
Sent: Sunday, October 21, 2007 12:54:12 PM (GMT-0500) America/New_York
Subject: Re: ANNOUNCE: XS-based minifiers for JS/CSS

If you'll pardon the devil's advocate bit...

Caching isn't really the issue - you can use mod_cache, or make  
your own

using CSS::Minifier.  I think Bjorn was questioning the
Apache2::Filter::Minifier:: approach.

Here's a different take on Apache2::Filter::Minifier.  I run a  
small web
dev shop, I code perl and manage the servers, and I have a small  
team of

web developers who make works of art using JS and CSS.  I have a few
hundred man-hours* per month for development.  We're talking about
simply deploying a module to speed up some sites, without it using up
many man-hours.  Thanks, Community!**   This helps me proudly tell my
customers about mod_perl, and in will help my business get to the  
point

where we can contribute code and ideas back to the community.

* woman-hours too, of course, but it's still all blokes here
** Community as in Graham, Geoffrey and co

John




--
Andrew Wyllie
Dilex Networks, LLC
[EMAIL PROTECTED]
866-479-4591





Re: Mod_Perl and MaxRequestsPerChild

2007-10-16 Thread Boysenberry Payne

I use in my  start.pl:

use Apache2::SizeLimit ();
$Apache2::SizeLimit::CHECK_EVERY_N_REQUESTS = 5;
$Apache2::SizeLimit::MAX_UNSHARED_SIZE = 5;

It might allow you to use prefork MPM without worrying so much about  
too much memory being taken.


-bop


On Oct 16, 2007, at 2:39 PM, Mark Maunder wrote:


Also, just some additional data for the archives and discussion: It
seems (in my case) that prefork is much more memory hungry than
worker. Here are the details:

I switched to a prefork model from worker MPM. As I mentioned before
my load avg seemed to drop, but memory usage went up. It continued to
rise as my processes grew. My mod_perl app works with some fairly
large data structures and AFAIK perl doesn't like to free memory back
to the OS once it's allocated it, so the processes tend to grow for
the first few hours of the server being up and then the plateau and
grow about 1 meg per day (a slow leak I think).

I brought up my server with prefork and only 150 children. As the
processes started growing my box ran out of memory, started swapping
heavily and I had to shut down and revert to worker.

I'm back on worker and I have a full 250 threads with much lower  
memory usage.


My unscientific data is as follows:

When i was running with prefork, each process was 29 Megs and there
were 150 of them. That's 4.3 Gigs and my box only has 2 Gigs so
apparently copy-on-write was in effect and some of that was shared.

Now that I'm back to threads, my largest process is 200Megs and there
are 5 of them (four seem to be consuming memory, so I assume the 5th
is the parent?). So the total memory consumed without sharing is 1
Gig.

So even without copy-on-write it seems that worker MPM is much more
memory efficient in my case. This may be something specific to my
config because my app is smaller than most apps I've written.

BTW, most of my app is written as handlers and all modules are loaded
in startup.pl.

Regards,

Mark.





On 10/16/07, Mark Maunder [EMAIL PROTECTED] wrote:
Thanks guys. I assumed worker would save me memory because threads  
are

light(er)weight. I'm busy trying prefork now and my load avg seems to
have dropped slightly, but my memory usage seems to have gone up
somewhat.

Just read your comments in the archives on copy-on-write Perrin - I
had no idea it doesn't work for threads. Thanks for that!

http://www.jsw4.net/info/listserv_archives/mod_perl/07-wk22/ 
msg00022.html


However, my original problem may still exist and I have more data  
now.

I noticed the number of httpd children just went up from 150 to 152
and is holding there and I also have two messages in my error log  
that

look like the following:

(70007)The timeout specified has expired: ap_get_brigade failed  
during

prefetch, referer: *snip*

I've looked at my logs going back the last 3 days and this message
appears several times over the last 3 days. It's the only message out
of the ordinary. I've googled this message before and haven't found
much of an explanation.

Have any of you seen this before? Any idea what causes it? I've
confirmed it appears whether I'm running as worker or prefork.

Thanks again for your help so far!

Mark.


On 10/16/07, Perrin Harkins [EMAIL PROTECTED] wrote:

On 10/16/07, Clinton Gormley [EMAIL PROTECTED] wrote:

Unless you have a really good reason to use worker, on linux, the
recommended MPM is worker.


I'm sure you meant to say prefork there.  And I agree, if you're
concerned about memory, don't use threads.  Prefork will save you
memory because of copy-on-write.

- Perrin







Re: Javascript minifier

2007-10-15 Thread Boysenberry Payne


On Oct 15, 2007, at 1:47 PM, Graham TerMarsch wrote:


On Sunday 14 October 2007 2:58 pm, Boysenberry Payne wrote:

I just tried putting the Javascript minifier onto our production
server since it was working so well on my local development  
server, and

I noticed an incredible slow down.

I was wondering if you had a change to look.


I'd be happy to have a look at this with you.  I took a quick check  
at the
URLs you'd sent in your message, though, and didn't see the same  
slowdown or
hang issue that you did.  I'm also -not- seeing the minifier  
kicking in, so

I'm gathering that for the moment you've turned it off.

I have noticed similar slowdowns on other sites that are using the  
minifying
filters, depending on how much JavaScript you're trying to minify;  
stuff like
prototype/script.aculo.us which weighs in at ~250KBytes takes a few  
seconds

to minify with JavaScript::Minifer.

That said, though, I have been working on XS versions of the JS+CSS  
minifiers
which should help address performance issues.  I've got devel  
versions here
locally that I've rewritten in XS that are ~200x faster than their  
pure-Perl
counterparts.  I should have both of these whipped into enough  
shape to be

able to upload devel versions to CPAN within the next 24-48hrs.


What I've noticed on that js page is it gets to 3.7 k out of 4.6 k
then hangs for a bit. It seems to do it for each js page.


Can't say that I was able to reproduce this myself, but that could  
be because

it looks like you've disabled the minifying filter.



I had to take it down so our clients didn't get effected...
I can put it back up to look at if you'd like for a little bit,  
ideally later at night,
or I can just wait until the newer XS version is in cpan, let me know  
which you'd prefer...






I checked out the server logs and saw this:
Use of uninitialized value in substitution (s///) at /usr/lib/perl5/
site_perl/5.8.0/Apache2/Filter/Minifier/JavaScript.pm line 46.
Use of uninitialized value in exists at /usr/lib/perl5/site_perl/
5.8.0/Apache2/Filter/Minifier/JavaScript.pm line 49.


This looks like its in/around the code that does the MIME-Type  
checking, to
make sure that we're only processing documents with the correct  
MIME-Type.
If this is 'undef', though, then we're not even finding a Content- 
Type
header in the response in order to figure out what kind of document  
we've got
and whether or not it can be minified.  I'll make sure to add in  
some extra
tests around this and get a fix rolled in to coincide with the XS  
minifiers

above, so that you've got something newer to test with.


I have the following in my httpd.conf file:
PerlOutputFilterHandler Apache2::Filter::Minifier::JavaScript


Do you have this wrapped in any sort of Location, Directory
or FilesMatch block, or is it just enabled globally?  Although  
it should
work globally (as the internal MIME-Type detection restricts it to  
only JS
files), you'll probably find things running faster if you only  
enable it for

specific parts of your site.

E.g.
  FilesMatch .js$
PerlOutputFilterHandler Apache2::Filter::Minifier::JavaScript
  /FilesMatch

That way we're not even incurring the overhead of MP2 and checking the
MIME-Type of the document unless we've got an idea that it could be  
JS.


I set the javascript MIME-Type in mod_perl via $r-content_type 
( text/javascript );


Here is what I have in the httpd.conf file:

Location /precess_request
SetHandler  perl-script
PerlResponseHandler Habitat::Apache2
PerlOutputFilterHandler Apache2::Filter::Minifier::JavaScript
Options +ExecCGI
/Location

Also, I only have the version you sent me directly installed on my  
local development server,
not the official cpan version.  I remember you making changes before  
you put the official version up,
so maybe that would explain the local version running differently.   
Of course, with one being CentOS

and my local dev being OSX that could be it too...

Anyway, I'm looking forward to using it, and appreciate the response.
I'll look forward to the XS version and plan on letting you know how  
it goes.


Thanks again,
Boysenberry Payne



Re: mod_perl success stories on ZDNet

2007-10-03 Thread Boysenberry Payne
If I have my own success story how would I go about adding it to the  
list?


-bop

On Oct 1, 2007, at 8:39 AM, Perrin Harkins wrote:


On 10/1/07, Carl Johnstone [EMAIL PROTECTED] wrote:

Is it me, or does that just link through to here:

http://www.oreillynet.com/digitalmedia/blog/2002/05/ 
perl_success_story_termiumplus.html


which doesn't require registration?


Yes.  Like I said, it's just content brought over from O'Reilly.  It's
not a new story.  We already have it on our success stories page.

- Perrin




Re: RFC: Apache2::Filter::Minifier::JavaScript

2007-09-19 Thread Boysenberry Payne
I could use something like this.  Right now I use Toolkit Template to  
build from.
It already caches the JS file loaded from disk.  I would want to then  
put it through
the minifier process and cache then serve.  Would you module allow  
for this?


-bop

On Sep 19, 2007, at 12:24 PM, Graham TerMarsch wrote:

I've been working on some projects needing JS minification recently  
and wanted
to ping others and find out if anyone else would find it useful to  
have a
mod_perl2 filter that auto-minified your JS (using  
JavaScript::Minifier)...


Am thinking along the lines of something that you'd set up in your  
Apache

config like:

FilesMatch \.js$
PerlOutputFilterHandler Apache2::Filter::Minifier::JavaScript
PerlSetVar MINIFIER_CACHE_ROOT /path/to/your/cache/dir
/FilesMatch

Results would be cached to disk, so that we didn't have to re- 
minify the JS
files on each and every request.  Obviously, if the original file  
changes,

the cached copy would be considered invalid.

Seeing the above makes me wonder, though... is there a way to set  
up a Perl

output filter for -just- specific MIME-Types?  Similarly to
AddOutputFilterByType, but for mod_perl handlers?

Thought I'd ask and see if others would find something like this  
useful, or if
you've got suggestions on other ways to do this.  I know that I  
could just
minify all the JS files on disk, but it'd be a whole lot simpler to  
just set
it up as a filter and not have to worry about it.  Also means that  
I could
turn the filter off during testing and be able to work with the un- 
minified

JS.

Also thinking that an Apache2::Filter::Minifier::CSS module would  
be possible

using CSS::Minifier; basically same thing but for CSS instead.

--
Graham TerMarsch




Re: RFC: Apache2::Filter::Minifier::JavaScript

2007-09-19 Thread Boysenberry Payne
If there is anything I can do to help let me know.  I'd really like  
to have a small footprint

on my JS output, right now its still pretty big.

Boysenberry Payne
Habitat Life, Inc.
http://www.habitatlife.com/

On Sep 19, 2007, at 12:49 PM, Graham TerMarsch wrote:


On Wednesday 19 September 2007 10:40 am, Boysenberry Payne wrote:

I could use something like this.  Right now I use Toolkit Template to
build from.
It already caches the JS file loaded from disk.  I would want to then
put it through
the minifier process and cache then serve.  Would you module allow
for this?


That'd be the idea... it'd just be a generic output filter that  
you'd have
to hook up yourself into your existing JS pipeline.  In my initial  
example I
used FilesMatch to do it, but you could hook it up anywhere that  
you can
set up a PerlOutpuFilterHandler.  It'd just take the JS that it was  
provided,
minify it, then cache the minified version.  On subsequent  
requests, it'd
(somehow) figure out that the cached copy was valid and then either  
use the

cached copy or re-minify+re-cache as necessary.

If we're dealing with -dynamically- generated JS, though, then I'll  
need to
think a bit more about how I deal with is our cached copy valid/ 
stale?, as
that'd be done differently than if just serving static JS files.   
I'll have a
look at that, though, as that's a good use case.  I'd initially  
thought of
using the r-finfo-inode() as a cache key, but I don't think  
that's there

if I'm being handed dynamically generated JS.

--
Graham TerMarsch





Re: Where to store uploads

2007-07-09 Thread Boysenberry Payne

I handle files with a db pointer.
Works really good for me.  I house all of the files
on a static server and put pointers in the DB.
Then I just update the DB with new pointers or remove
pointers as needed.
When looking up a file I request the DB file pointer
then use that info to grab it from the static server.
Works like a charm.

-bop


On Jul 3, 2007, at 9:34 AM, Clinton Gormley wrote:


On Tue, 2007-07-03 at 10:26 -0400, Perrin Harkins wrote:

On 7/3/07, Clinton Gormley [EMAIL PROTECTED] wrote:
1) In the DB, store the name of the server to which your file has  
been

   uploaded


I try to avoid files in the DB.  It always ends in tears.


Sorry - I meant, store this in the DB:
 - ID:  1234
 - type:image/jpeg
 - path:12/34/1234.jpg
 - server:  images1.domain.com

So that your program would construct a URL pointing to the correct
server, or a translation layer would forward the request to the  
correct

server




2) Store your upload in a shared partition (eg on a SAN, NFS,
   iSCSI/OCFS2)


That's ok if you need them on every server.  Many applications just
upload a file and process it on one server, so they don't need this.


Sure - I was thinking primarily of image hosting.

thanks

Clint


- Perrin






Re: Simple examples?

2007-06-17 Thread Boysenberry Payne

Iļja,

Try this recipe:

http://perl.apache.org/docs/2.0/user/coding/ 
cooking.html#Sending_Cookies_Using_libapreq2


-bop

On Jun 17, 2007, at 7:42 AM, Iļja Ketris wrote:


Hello,

I have read through many mod_perl docs from the site and still find
myself unable to perform the simplest tasks to get started.

Is there a simple example, such as input form processing, given in  
one piece?

With no references to CGI, to mod_perl1, and to migration issues?

Thank you.



--
Iļja Ketris | iPro SIA  | +371 800 IPRO




Re: After retrieving data from DB, the memory doesn't seem to be freed up

2007-05-14 Thread Boysenberry Payne

On May 11, 2007, at 12:05 PM, Michael Peters wrote:



This kind of thing happens all the time. Think of SAX XML parsers  
or mod_perl
filters. It's not terribly difficult to parse something in chunks  
like that.


I wasn't saying that it wouldn't be easier to have everything in  
memory. Heck
I'd love it if I never had to read a file in line by line anymore  
and could just
slurp them all into arrays. But knowing when to put all of  
something into memory

and when not to is part of being a programmer.


Okay, quick question related to this.  How do I send the appropriate  
Content-Length

headers in a situation where I don't read all of the data into memory.

Currently, I do something like this:

my $output = Some string;
{
use Apache2::Response();
use bytes;
$r-set_content_length(length($output));
}

$r-rflush();
$r-print($output);

If I'm chunking would I re-send the Content-Length header for each  
chunk?
I'm assuming the Bucket Brigade has something to do with this being  
received

by the browser okay...

Boysenberry Payne
[EMAIL PROTECTED]




Re: Perl and ASP.Net

2007-04-30 Thread Boysenberry Payne

On Apr 27, 2007, at 12:19 AM, Foo JH wrote:


Boysenberry Payne wrote:

One of the draw back that seems to be evident to me as I've looked
into the client side frameworks is changes in the code are ought
of your control.  WIth a purely server side solution it would seem
to give the coder the choice to upgrade when there is time, etc.
With the 3rd party frameworks they choose when you upgrade.
For the more stable solutions this is less of a problem.  For the
newer technologies I've heard a lot of grumbling about having
to recode every time there is an upgrade...
My take on the current situation on client-side frameworks (AJAX- 
styled?) is that it's a bit wild. We have scriptaculous, prototype,  
yui, rico and more. Each of them do parts of a framework (eg. drag- 
n-drop, controls), but even the concept of a client-side framework  
is kinda hazy. What constitutes a client-side framework exactly?


So until some organisation big enough comes along to offer a  
defacto implementation that everybody will take reference from,  
expect changes and more changes. This of course is good news for  
web ui developers - more jobs stability for everybody! On the flip  
side, IE7-8-9 will continue to make a nuisance of themselves.


Are you FireFoxed yet?


I use FireFox quite a bit now a days, it's the only cross platform  
browser I can
use that shows up on both PCs and Macs pretty reliably, besides all  
of the nifty

debugging tools.

Up until now I've written all of my own JS, to avoid bloat or  
unnecessary code

as well as keep my learning curve of new APIs to a minimum.

Until a couple of months ago our product only published to Flash swf  
files
so it wasn't even an issue.  Just recently, I updated our publisher  
to publish to

html also, now JS is a bigger deal.

The reason I haven't just jumped right into using JS frameworks is  
partially
bloat, partially issues of propriety, and finally not knowing which  
one is

going to offer me what I need.

Its hard enough trying to stay on top of using the right perl module for
the task at hand, and they're all easy to find and study.

Currently, without something like cpan for JS and with most of our  
administration
tasks being handled via Actionscript in the client browser I'm  
probably going
to take my time and continue writing most of my JS; most of it is  
pretty specific
to our publisher's needs anyway, e.g. formatting a page around  
predefined

look and feel, JS menu behaviors, cookie warnings, etc...

I don't know what I would do without cpan.  I'm surprised other  
languages don't

offer the same tech.  Perl certainly is a one of a kind phenomena

Thanks for all of the pointers and feedback.  If nothing else I'm  
sure I can learn from

technology available in the frameworks already mentioned.


Boysenberry Payne
[EMAIL PROTECTED]







Re: Perl and ASP.Net

2007-04-25 Thread Boysenberry Payne

One of the draw back that seems to be evident to me as I've looked
into the client side frameworks is changes in the code are ought
of your control.  WIth a purely server side solution it would seem
to give the coder the choice to upgrade when there is time, etc.
With the 3rd party frameworks they choose when you upgrade.
For the more stable solutions this is less of a problem.  For the
newer technologies I've heard a lot of grumbling about having
to recode every time there is an upgrade...

-bop


On Apr 25, 2007, at 2:08 AM, Foo JH wrote:



ASP.Net tries to do both the server and client side (sometimes the  
programmer
doesn't even know if his C# code is actually going to be run on  
the server or
the client). Perl (and on this list mod_perl) takes care of the  
server side but

leaves the client side up to you.

I believe that's the grand strategy for C# developers. If they can  
write code that can easily be ported from the web to (for example)  
a mobile platform, it is a very good business strategy.



I think the OSS community is actually ahead of .Net in this regard  
since you
aren't tied to a particular back-end system. Choice does mean you  
need more
knowledge though. Start looking around and evaluate and pick one  
that suits your

needs.
I'm actually quite glad that we have two options (or more, in  
favour of the Perl TIMTOWTDI mantra) of implementation a web-based  
application. The ASP.NET way makes putting together an application  
quick and easy, abstracting the details of client-server  
communication as much as possible. This is aligned to the real- 
world scenario where too many businesses expect 'instant  
applications' to respond to their new-fangled ventures.


The we-do-purely-backend-stuff alternative that is modperl  
concentrates on making the web app agile yet robust. To put it  
objectively, it is the tradditional approach to writing web  
applications. It works, it's proven, and there is good community  
and professional support for this kind of framework.


Looking forward, I personally believe in the pervasiveness of the  
dynamic and asynchronous interactivity between the client and the  
browser. Module(s) that enable such features will be a milestone in  
making modperl (and Perl itself) relavant in the ever changing web  
landscape.




Re: Perl and ASP.Net

2007-04-25 Thread Boysenberry Payne

On Apr 25, 2007, at 11:52 AM, Michael Peters wrote:


Boysenberry Payne wrote:

One of the draw back that seems to be evident to me as I've looked
into the client side frameworks is changes in the code are ought
of your control.  WIth a purely server side solution it would seem
to give the coder the choice to upgrade when there is time, etc.
With the 3rd party frameworks they choose when you upgrade.
For the more stable solutions this is less of a problem.  For the
newer technologies I've heard a lot of grumbling about having
to recode every time there is an upgrade...


Huh? The JS in your project is always under your control. It's just  
like any 3rd
party component (like CPAN modules). You only upgrade it when you  
want to. The
only case that I know of where people pull in 3rd party JS  
components that
aren't locally controlled are those that use YUI and pull in their  
publicly
hosted files. (And this is only to boost download time since if  
every site using
the YUI libraries uses the same URL, a browser should just be able  
to use a

cached version). But even then you can specify specific versions.



It was Yahoo's yui-ext library aka extjs that I was told this could  
really be a problem

with.  So I guess all JS frameworks aren't created equal.

Can you recommend a site or resource for comparison of the differing  
frameworks?


It would seem like there is definitely a place for this in our  
product, saving me lots of development

time and all.

PS Sorry for the non mod_perl noise.  I'm hoping its well tolerated,  
in that I use mod_perl
extensively and need to learn integrate it with other non-mod_perl  
tech, e.g. it

serves up my JS, etc...


Boysenberry Payne
[EMAIL PROTECTED]



File Uploads using MP2 best practises

2007-04-06 Thread Boysenberry Payne


Currently, I'm using a 2 server setup.  Our static server (apache 1  
 php) handles the initial
request and uses mod_rewrite to proxy to our perl server (apache2  
 mod_perl2).
Our static server serves up files etc, except when MP is needed then  
it sends the request

to our perl server.
It works great for most stuff.

When it comes to uploading files I'm wondering if there isn't a  
better way than I'm doing it now.
Currently, I have file uploads proxy to the perl server, which then  
FTPs the file(s) to the static
server.  Not only does this tie up an otherwise fast MP child  
process, it does so for nearly twice

as long as it would if the file just ended up on the same server.

The obvious solution would seem to be setup the file upload code on  
the static server and skip
the perl server altogether.  The problem with this solution is  
authorization, etc happens on the perl
server (and with a rather complicated setup, the mysql server resides  
there too.)


Now I could go and write what I'd need on the static server (it has  
php installed as well as cgi,) but
doing that kind of defeats the elaborate system I've already  
developed and forces me to develop
using solutions other than MP to get file uploads working, not to  
mention the million other reasons

I'd prefer to stay with MP and avoid PHP, or CGI alternatives.

What I'm wondering is am I missing something obvious?
and...
How are other people handling this?  I can't imagine I'm the only  
person running into this...


Thanks in advance,
Boysenberry Payne
[EMAIL PROTECTED]





using axkit with mod_perl

2007-01-10 Thread Boysenberry Payne

It seems like they're mutually exclusive technologies.

Can they both be installed in one Apache server to good effect?

I'm sorry if this is the wrong list for this question.  I'm asking here
because I use an Apache2 mod_perl2/libapreq2 build as our application
server (static apache front end using proxy to the mod_perl server.)

I'm hoping for the power of both without the overhead of extra hardware.
Pipe dreams right?

If so should I just look at building the xml tech into my current  
mod_perl

build via cpan as best as I can?

Any advice is much appreciated.

Thanks,
Boysenberry Payne
[EMAIL PROTECTED]





Using OO with mod_perl correctly to avoid leaks

2006-12-22 Thread Boysenberry Payne
I've been poring over the Perl Best Practices book as of late, lovely  
work, wish

I would have read it when it first came out

Anyway, I'm curious about a way I'm using variables, here is my example:

package Habitat::Definitions;
use Class::Std::Utils;
{
use strict;
use base qw( Habitat );

my %definitions_of;

#
# Initialize definitions
#
sub new {

my( $class ) = @_;
my $self = bless anon_scalar(), $class;

my $defs = {};

$defs-{server_user} = $ENV{HOME} ? perl : boysie;

# setup external ips
		$defs-{servers} = { dynamic = '192.168.0.1', static =  
'192.168.0.2' };


# default redirect
$defs-{real_habitat} = http://www.habitatlife.com/habitat/;;

$definitions_of{ ident $self } = $defs;
# not returning $self, but $definitions hash reference instead
return $definitions_of{ident $self};
}

sub DESTROY {
my ( $self ) = @_;

delete $definitions_of{ident $self};
}
}
1;

...then later

my $defs = Habitat::Definitions-new();

...and later still...

my $usr = $defs-{server_user};

$defs-{root_directory} = /Users/$usr/;


Is this bad usage?

Am I creating the same situation using inside-out classes seek to avoid,
i.e. accessing object internals directly via manipulating  
$definitions_of{ident Habitat::Definitions}?


Is this kind of structure still prone to leak memory?

What are the ramifications of not returning the $self blessed reference?


Thanks for any help,
Boysenberry Payne
[EMAIL PROTECTED]





Re: getting to know more about mod_perl

2006-08-29 Thread Boysenberry Payne

I started as a PHP/Javascript guy, then moved to Perl.
Perl has proven to be way more flexible a language to
program in, a pro to me, a con to some.

Besides its support for myriad programming styles, CPAN
offers hundreds, if not thousands of open source modules
to use with perl.  This is good for rapid development as well
as rapid learning of the syntax.  I could find that in the PHP
communities.

As far as mod_perl with apache goes, there are others on
this list who can answer the details of a comparison better
than I.  What I will say is mod_perl has proven to be more
scalable and much faster on my production servers.

Basically, I let our users have php for their script, but stick
to mod_perl for mine.

I think its easier to really bring down a whole server with
mod_perl than it is with php.  Both can be dangerous in
the wrong hands, but PHP seems easier for novice programmers
and for small quick self contained projects.  I don't know
of anything else as well behaved and robust as mod_perl
for the serious programmer; I prefer it to Java any day...

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Aug 29, 2006, at 1:20 PM, Adriano Ferreira wrote:


Hi, mod_perl people.

I am preparing a presentation about technologies which make Perl more
visible. In this vein, I would like to say a few words about mod_perl.
But I am short of knowledge on this subject and need to understand
some things about it, to sound convivincing. Then I dare to bother
the list with some questions. I will be very grateful by your answers,
even if they are Dull question. Read this and read that, add two and
two, make four and bug me not.

Q: how does mod_perl compares to PHP? Both are interpreters inside the
Apache web server, ain't it? I am interested in all shades of
distinction and similarity here: performance, cost, safety, marketing,
etc.

Thanks a lot for any help.

Best regards,
Adriano Ferreira






Re: Protecting source code

2006-08-25 Thread Boysenberry Payne

What about products like CPANEL, how do they do it?
There must be some standard usage already with Perl
being as prevalent as it is.

Currently we've separated our perl code out onto its own server
and use proxies to get to and fro.

It keeps a level of protection on our code.

We just serve the output to our clients instead.

Obviously it means we have an overhead to maintain, but our code
is worth it to us.

Originally it was written in php, I had to migrate it all.  Was easy  
with perl.


Security seems to be such a big issue in so many areas besides
the code even, that one just settles for the best one can do.

Keeping control of the code seems to be the most secure approach
in my mind.  Once you give it to someone else, given enough time
they will figure it out.

Same is true with security everywhere, banks, homes, dvds, etc...


Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Aug 25, 2006, at 2:00 PM, David Nicol wrote:


I think that if obfuscating the source code (by compiling or
encrypting or whatever) is a high priority for you, then Perl may not
be the best choice of language for your software. And even for Java
there are decompilers and for PHP the code must be unencrypted to
run. So maybe C is the best choice.


Bleach.pm is pretty fun, as are the other ones like it.  Making all  
the
variable names difficult and easy-to-confuse; adding garbage that  
looks
like code and making the code look like garbage; there is a lot of  
room
to improve code obfuscators.  Obfuscation and pretty-printing are  
two sides
of the same problem.  Why don't people decompile and disassemble as  
much

as they used to?  It's difficult.  Obfuscation works the same way.

At my company, we wound up distributing a demonstration of a system  
that
was largely written in perl as a locked VMware virtual machine in  
order to
draw a clear box around it.  Sure someone who was knowlegable w/  
vmware
would be able to reset the config password on the virtual bios and  
so on, but
the line would have been crossed, as surely as removing the hard  
drive and

mounting it in another system would have.






Re: urgent help needed

2006-07-27 Thread Boysenberry Payne
Here is what I used to install libapreq2:

at command line:

perl5.8.8 MakeFile.PL --with-apache2-apxs=/usr/local/apache2/bin/apxs --enable-perl-glue --with-perl=/usr/local/bin/perl5.8.8

make  make test
make install


Then in the httpd.conf file:

LoadModule apreq_module/usr/local/apache2/modules/mod_apreq2.so

If you're getting errors on make test some can be ignored, some can't.  You might want to
check on: [EMAIL PROTECTED] libapreq's mailing list too...


Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Jul 27, 2006, at 7:35 AM, philge philip wrote:

Dear colleague
 
I am a bioinformatics programmer from India.I need a guidance for configuring mod_perl2.0 in my server.
 
I have Apache.2.0.5.2 and Perl 5.8.5 installed in Fedora 3 operating system.
I downloaded mod_perl2.0 version and installed it with the following commands:
 
Perl MakeFfile.PL    MP_AP_PREFIX=/apxs path
Make
Make install
 
Next I added the lines:
 
LoadModule perl_module modules/mod_perl.so
PerlModule Apache2
 
to httpd.conf
 
when I tried restarting the server we got an error like cant locate perl module Apache2.pm module in @INC
Though I corrected this error once and when I tried to load Apache2::Request module in the script I got an error like cant locate perl module Apache2::Request.pm in @INC.
 
I tried installing the libapreq2-2.07 module to include Apache2::Request module but I am unable to load it.
 
Please guide me how to load the Apache2.pm module and load Apache2::request module.I  have a doubt whether I have to upgrade our Perl version since we got an error while trying with modperl2 rpm version and whether Fedora3 will support higher versions of perl?Kindly guide me please.Its urgent.
 
Yours Sincerely
 
Philge Philip

How low will we go? Check out Yahoo! Messenger’s low  PC-to-Phone call rates.

Trying to get my old MP2 config to work with Apache2.2

2006-07-09 Thread Boysenberry Payne
I'm getting another error now that I seem to have all of the packages updated.

In the webpage:
Forbidden
You don't have permission to access /pro/habitat.pl on this server.

In the error log:
[Sun Jul 09 03:20:35 2006] [error] [client 69.72.241.162] client denied by server configuration: /home/perl/production/habitat.pl


The config for my mp handler is:

Alias /pro/ /home/perl/production/
Location /pro>
SetHandler perl-script
PerlResponseHandler  Habitat::Apache2
/Location>

I think it has something to do with a confliction coming from the following modules:

LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so

I installed with shared all, to avoid spending hours picking and choosing,
maybe I should have spent more time.  I read in one of the auth mods
that it can prevent virtual files denying access.  If I remark the mods above
outright I get a syntax error stating Order is wrong in:

Directory />
Options -Indexes FollowSymLinks
AllowOverride None
Order Deny,Allow
Deny from all
/Directory>

Any ideas on how I can get this working?  Right now my production server
is down because of this, so any help would be much appreciated.

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com


Re: Trying to get my old MP2 config to work with Apache2.2

2006-07-09 Thread Boysenberry Payne
Unfortunately my development server is an OS X box and my production  
server
is a Linux box.  So even though I tried locally first I ran into  
difficulties with getting
Math-Pari installed and decided a late night weekend attempt might be  
my best chance.
I think it would have been easier, in that I could have kept my  
httpd.conf file largely
intact if I had went for Apache2.0.58 over Apache2.2.2.  If I can get  
it working it

will have been worth it though.

Removing the Deny All certain made the difference, thanks.

Now I'm stuck with the following:

/usr/local/apache2/bin/httpd: relocation error:  
/usr/local/lib/perl5/site_perl/5.8.8/i686-linux/auto/APR/Request/ 
Apache2/Apache2.so: undefined symbol: apreq_handle_apache2


Any ideas why this would happen?

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Jul 9, 2006, at 2:35 AM, Philip M. Gollucci wrote:


Boysenberry Payne wrote:
Any ideas on how I can get this working? Right now my production  
server

is down because of this, so any help would be much appreciated.
You mean you didn't test and upgrading before doing it in production  
first ?

*Sigh*


--
--- 
-

Philip M. Gollucci ([EMAIL PROTECTED]) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

In all that I've done wrong I know I must have done something right to
deserve a hug every morning and butterfly kisses at night.






Re: Trying to get my old MP2 config to work with Apache2.2

2006-07-09 Thread Boysenberry Payne
Sorry I meant to hit reply to all, but it slipped, I did resent to the  
list though.


Also, sorry some of this is really of list, like the deny all bit.

You've been really helpful though, thank you.

I forgot I remarked the 'LoadModule apreq_module modules/mod_apreq2.so'  
line
while I was rebuilding it.  I guess it doesn't pay to be tired while  
updating a production

server.  I should really fire myself, but alas, I'm the only one...

Up until recently the production server was managed for me, so this is  
my first

time even messing with it.

It seems like I'm back on track now, just need to install some modules  
via cpan

and hopefully all is well...

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Jul 9, 2006, at 2:57 AM, Philip M. Gollucci wrote:


Boysenberry Payne wrote:

/usr/local/apache2/bin/httpd: relocation error:
/usr/local/lib/perl5/site_perl/5.8.8/i686-linux/auto/APR/Request/ 
Apache2/Apache2.so:

undefined symbol: apreq_handle_apache2

Yeah its a FAQ and I'm pretty sure you asked it before:

LoadModule apreq_module modules/mod_apreq2.so

[Keep it onlist]

--
--- 
-

Philip M. Gollucci ([EMAIL PROTECTED]) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

In all that I've done wrong I know I must have done something right to
deserve a hug every morning and butterfly kisses at night.






make test fails on Red Hat Linux

2006-07-08 Thread Boysenberry Payne
Using Apache2.2.2 I get the following errors while trying to make test  
mp2.0.2


Failed Test  Stat Wstat Total Fail  List of Failed
 
---

t/apache/content_length_header.t   271  17
t/api/status.t  62  4-5

then from the log:

*** The following error entry is expected and harmless ***
Argument foo9bar isn't numeric.
Constant subroutine Apache2::Reload::Test::const redefined at  
/usr/local/src/mod_perl-2.0.2/blib/lib/ModPerl/Util.pm line 69.
Subroutine subpackage redefined at  
/usr/local/src/mod_perl-2.0.2/t/lib/Apache2/Reload/Test.pm line 7.
Subroutine run redefined at  
/usr/local/src/mod_perl-2.0.2/t/lib/Apache2/Reload/Test.pm line 9.
Subroutine simple redefined at  
/usr/local/src/mod_perl-2.0.2/t/lib/Apache2/Reload/Test.pm line 15.
Prototype mismatch: sub Apache2::Reload::Test::const: none vs () at  
/usr/local/lib/perl5/5.8.8/constant.pm line 103.
Subroutine prototype redefined at  
/usr/local/src/mod_perl-2.0.2/t/lib/Apache2/Reload/Test.pm line 17.
Constant subroutine Apache2::Reload::Test::const redefined at  
/usr/local/src/mod_perl-2.0.2/blib/lib/ModPerl/Util.pm line 69.
Subroutine subpackage redefined at  
/usr/local/src/mod_perl-2.0.2/t/lib/Apache2/Reload/Test.pm line 7.
Subroutine run redefined at  
/usr/local/src/mod_perl-2.0.2/t/lib/Apache2/Reload/Test.pm line 9.
Subroutine simple redefined at  
/usr/local/src/mod_perl-2.0.2/t/lib/Apache2/Reload/Test.pm line 15.
Prototype mismatch: sub Apache2::Reload::Test::const: none vs () at  
/usr/local/lib/perl5/5.8.8/constant.pm line 103.
Subroutine prototype redefined at  
/usr/local/src/mod_perl-2.0.2/t/lib/Apache2/Reload/Test.pm line 17.
Constant subroutine Apache2::Reload::Test::const redefined at  
/usr/local/src/mod_perl-2.0.2/blib/lib/ModPerl/Util.pm line 69.


I'm not sure if I'm catching the right errors in the log.

Any ideas on what I need to fix to get it working?  Does it matter that  
I have Apache2.46 running while I test the new install?
I configured, made, and installed apache2.0.2 while 2.46 was still  
running, could that be causing this?


Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com



Re: Is Apache::DB still the way to interactively debug via MP2

2006-07-03 Thread Boysenberry Payne

  I'm not very familiar with Apache on OSX, does it by default
  run setuid and/or setgid?  Also are you running with taint on?

  There was an issue with Apache::SmallProf and Apache::DProf when
  running under taint mode, and I'm curious if it's also a problem
  for Apache::DB itself.


Yes I do have taint on.  I thought it was wise for the production  
server.

Should I just turn it off on my development server?

I don't think Apache on OSX runs setuid by default.  I used Apache::DB
once before with my old Apache1.33/MP1 config and never had this
happen.

Could this have something to do with Toolkit Template and the includes
it uses, e.g. if they have the wrong group on the files, etc, or maybe  
something

similar.

This is really hard for me to debug, because it errors out before the
debugger does anything more than print the first line of code:

Habitat::Apache2::handler(/Users/boysie/habitat/perl/modules/Habitat/ 
Apache2.pm:35):

35:   my $r = shift;

error_log:
Insecure $ENV{PATH} while running setgid at  
/Library/Perl/5.8.1/darwin-thread-multi-2level/Term/ReadKey.pm line  
334.\nCompilation failed in require at  
/Library/Perl/5.8.1/Term/ReadLine/Perl.pm line 63.\n


On the second request, the debugger behaves as it should...



Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Jul 3, 2006, at 10:00 AM, Frank Wiles wrote:


On Sun, 2 Jul 2006 11:25:27 -0500
Boysenberry Payne [EMAIL PROTECTED] wrote:


I little more info, the setgid error only happens on the first request
and only while debugging, as far as I can tell.


Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com


On Jul 2, 2006, at 8:35 AM, Boysenberry Payne wrote:


That fixed the print issue but I'm still getting the following
error:

Insecure $ENV{PATH} while running setgid at
/Library/Perl/5.8.1/darwin-thread-multi-2level/Term/ReadKey.pm
line 334.\nCompilation failed in require at
/Library/Perl/5.8.1/Term/ReadLine/Perl.pm line 63.\n

How can I tell what is causing the error?
I get it before the first line of code is run in my handler, so
I'm guessing its
something during compile that causes it.  Am I off base?

Is Apache2 or MP2 compiled improperly maybe?

Any suggestions?


  Sorry was off having a rare computer free weekend.  :)

  I'm not very familiar with Apache on OSX, does it by default
  run setuid and/or setgid?  Also are you running with taint on?

  There was an issue with Apache::SmallProf and Apache::DProf when
  running under taint mode, and I'm curious if it's also a problem
  for Apache::DB itself.

 -
   Frank Wiles [EMAIL PROTECTED]
   http://www.wiles.org
 -







Re: Is Apache::DB still the way to interactively debug via MP2

2006-07-02 Thread Boysenberry Payne

That fixed the print issue but I'm still getting the following error:

Insecure $ENV{PATH} while running setgid at  
/Library/Perl/5.8.1/darwin-thread-multi-2level/Term/ReadKey.pm line  
334.\nCompilation failed in require at  
/Library/Perl/5.8.1/Term/ReadLine/Perl.pm line 63.\n


How can I tell what is causing the error?
I get it before the first line of code is run in my handler, so I'm  
guessing its

something during compile that causes it.  Am I off base?

Is Apache2 or MP2 compiled improperly maybe?

Any suggestions?


Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Jul 1, 2006, at 9:49 PM, Philip M. Gollucci wrote:


Boysenberry Payne wrote:
print vs $r-print still works.  Is it better to use one over the  
other?

If I change all of my $r-print statements to read print instead will
I need to expect trouble?

do you have this in the file in question ?
use Apache2::RequestIO ()
use Apache2::RequestRec ()

just because you put in in startup.pl doesn't mean you shouldn't put  
it in the file itself.



--- 
-

Philip M. Gollucci ([EMAIL PROTECTED]) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

In all that I've done wrong I know I must have done something right to
deserve a hug every morning and butterfly kisses at night.






Re: Is Apache::DB still the way to interactively debug via MP2

2006-07-02 Thread Boysenberry Payne

I little more info, the setgid error only happens on the first request
and only while debugging, as far as I can tell.

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Jul 2, 2006, at 8:35 AM, Boysenberry Payne wrote:


That fixed the print issue but I'm still getting the following error:

Insecure $ENV{PATH} while running setgid at  
/Library/Perl/5.8.1/darwin-thread-multi-2level/Term/ReadKey.pm line  
334.\nCompilation failed in require at  
/Library/Perl/5.8.1/Term/ReadLine/Perl.pm line 63.\n


How can I tell what is causing the error?
I get it before the first line of code is run in my handler, so I'm  
guessing its

something during compile that causes it.  Am I off base?

Is Apache2 or MP2 compiled improperly maybe?

Any suggestions?


Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Jul 1, 2006, at 9:49 PM, Philip M. Gollucci wrote:


Boysenberry Payne wrote:
print vs $r-print still works.  Is it better to use one over the  
other?

If I change all of my $r-print statements to read print instead will
I need to expect trouble?

do you have this in the file in question ?
use Apache2::RequestIO ()
use Apache2::RequestRec ()

just because you put in in startup.pl doesn't mean you shouldn't put  
it in the file itself.



-- 
--

Philip M. Gollucci ([EMAIL PROTECTED]) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

In all that I've done wrong I know I must have done something right  
to

deserve a hug every morning and butterfly kisses at night.










Re: Is Apache::DB still the way to interactively debug via MP2

2006-07-01 Thread Boysenberry Payne

I'm not sure what your doing that you need to be running setgid though.


Me either.
Do any of these require setgid that you know of?

use APR::Pool ();
use Apache::DB ();
Apache::DB-init();

use Apache::DBI ();
use Apache2::Connection ();
use Apache2::Const -compile = qw( OK REDIRECT FORBIDDEN );
use Apache2::Cookie ();
use Apache2::Request ();
use Apache2::Upload ();
use APR::Request::Apache2 ();
use Email::Send ();
use HTML::TreeBuilder ();
use Template ();
use URI::Escape ();

I used egrep on all of my custom modules and came up with nothing.
I says during install_driver(mysql)  would it be from changing  
databases,
e.g. starting in one database/user than switching to another  
database/user?


Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Jun 30, 2006, at 6:36 PM, Philip M. Gollucci wrote:


Boysenberry Payne wrote:

That helped me get the Debugger working thank you.
Now its cutting out with this error in the error log:
[Fri Jun 30 17:55:23 2006] [error] [client 127.0.0.1]  
install_driver(mysql) failed: Insecure $ENV{PATH} while running  
setgid at  
/Library/Perl/5.8.1/darwin-thread-multi-2level/Term/ReadKey.pm line  
334.\nCompilation failed in require at  
/Library/Perl/5.8.1/Term/ReadLine/Perl.pm line 58.\n\n at  
/Users/boysie/habitat/perl/modules/Habitat/Apache2/DB.pm line 39\n

How come its saying the $ENV{PATH} is insecure?
Any ideas?

perldoc perlsec.

By default path is tainted unless you untaint it.

I'm not sure what your doing that you need to be running setgid though.


--  
--- 
-

Philip M. Gollucci ([EMAIL PROTECTED]) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

In all that I've done wrong I know I must have done something right to
deserve a hug every morning and butterfly kisses at night.






Re: Is Apache::DB still the way to interactively debug via MP2

2006-07-01 Thread Boysenberry Payne

I'm getting the following error only when I debug:

Can't locate object method print via package Apache2::RequestRec at  
/Users/boysie/habitat/perl/modules/Habitat/Apache2/Template.pm line  
69.\n


Line 69:
$r-print( $output ) if $output;

Where $r is Apache2::RequestRec

Any ideas?  It was working fine yesterday, the only thing different is  
the debugger now,
and I even have it remarked out and still get this error.  It doesn't  
make any sense to me.

Why would Apache2:RequestRec loose the print subroutine?



Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Jul 1, 2006, at 1:36 AM, Boysenberry Payne wrote:

I'm not sure what your doing that you need to be running setgid  
though.


Me either.
Do any of these require setgid that you know of?

use APR::Pool ();
use Apache::DB ();
Apache::DB-init();

use Apache::DBI ();
use Apache2::Connection ();
use Apache2::Const -compile = qw( OK REDIRECT FORBIDDEN );
use Apache2::Cookie ();
use Apache2::Request ();
use Apache2::Upload ();
use APR::Request::Apache2 ();
use Email::Send ();
use HTML::TreeBuilder ();
use Template ();
use URI::Escape ();

I used egrep on all of my custom modules and came up with nothing.
I says during install_driver(mysql)  would it be from changing  
databases,
e.g. starting in one database/user than switching to another  
database/user?



Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com


On Jun 30, 2006, at 6:36 PM, Philip M. Gollucci wrote:


Boysenberry Payne wrote:

That helped me get the Debugger working thank you.
Now its cutting out with this error in the error log:
[Fri Jun 30 17:55:23 2006] [error] [client 127.0.0.1]  
install_driver(mysql) failed: Insecure $ENV{PATH} while running  
setgid at  
/Library/Perl/5.8.1/darwin-thread-multi-2level/Term/ReadKey.pm line  
334.\nCompilation failed in require at  
/Library/Perl/5.8.1/Term/ReadLine/Perl.pm line 58.\n\n at  
/Users/boysie/habitat/perl/modules/Habitat/Apache2/DB.pm line 39\n

How come its saying the $ENV{PATH} is insecure?
Any ideas?

perldoc perlsec.

By default path is tainted unless you untaint it.

I'm not sure what your doing that you need to be running setgid  
though.



--  
-- 
--

Philip M. Gollucci ([EMAIL PROTECTED]) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

In all that I've done wrong I know I must have done something right  
to

deserve a hug every morning and butterfly kisses at night.










Re: Is Apache::DB still the way to interactively debug via MP2

2006-07-01 Thread Boysenberry Payne

To clarify, I get the error now whether I debug or not.
Until I started to debug I wasn't getting the error.
I don't think I changed anything in my code to cause this though...

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Jul 1, 2006, at 1:37 PM, Boysenberry Payne wrote:


I'm getting the following error only when I debug:

Can't locate object method print via package Apache2::RequestRec  
at /Users/boysie/habitat/perl/modules/Habitat/Apache2/Template.pm line  
69.\n


Line 69:
$r-print( $output ) if $output;

Where $r is Apache2::RequestRec

Any ideas?  It was working fine yesterday, the only thing different is  
the debugger now,
and I even have it remarked out and still get this error.  It doesn't  
make any sense to me.

Why would Apache2:RequestRec loose the print subroutine?



Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Jul 1, 2006, at 1:36 AM, Boysenberry Payne wrote:

I'm not sure what your doing that you need to be running setgid  
though.


Me either.
Do any of these require setgid that you know of?

use APR::Pool ();
use Apache::DB ();
Apache::DB-init();

use Apache::DBI ();
use Apache2::Connection ();
use Apache2::Const -compile = qw( OK REDIRECT FORBIDDEN );
use Apache2::Cookie ();
use Apache2::Request ();
use Apache2::Upload ();
use APR::Request::Apache2 ();
use Email::Send ();
use HTML::TreeBuilder ();
use Template ();
use URI::Escape ();

I used egrep on all of my custom modules and came up with nothing.
I says during install_driver(mysql)  would it be from changing  
databases,
e.g. starting in one database/user than switching to another  
database/user?



Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com


On Jun 30, 2006, at 6:36 PM, Philip M. Gollucci wrote:


Boysenberry Payne wrote:

That helped me get the Debugger working thank you.
Now its cutting out with this error in the error log:
[Fri Jun 30 17:55:23 2006] [error] [client 127.0.0.1]  
install_driver(mysql) failed: Insecure $ENV{PATH} while running  
setgid at  
/Library/Perl/5.8.1/darwin-thread-multi-2level/Term/ReadKey.pm line  
334.\nCompilation failed in require at  
/Library/Perl/5.8.1/Term/ReadLine/Perl.pm line 58.\n\n at  
/Users/boysie/habitat/perl/modules/Habitat/Apache2/DB.pm line 39\n

How come its saying the $ENV{PATH} is insecure?
Any ideas?

perldoc perlsec.

By default path is tainted unless you untaint it.

I'm not sure what your doing that you need to be running setgid  
though.



--  
- 
---

Philip M. Gollucci ([EMAIL PROTECTED]) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

In all that I've done wrong I know I must have done something right  
to

deserve a hug every morning and butterfly kisses at night.














Re: Is Apache::DB still the way to interactively debug via MP2

2006-07-01 Thread Boysenberry Payne

print vs $r-print still works.  Is it better to use one over the other?
If I change all of my $r-print statements to read print instead will
I need to expect trouble?

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Jul 1, 2006, at 1:40 PM, Boysenberry Payne wrote:


To clarify, I get the error now whether I debug or not.
Until I started to debug I wasn't getting the error.
I don't think I changed anything in my code to cause this though...

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Jul 1, 2006, at 1:37 PM, Boysenberry Payne wrote:


I'm getting the following error only when I debug:

Can't locate object method print via package Apache2::RequestRec  
at /Users/boysie/habitat/perl/modules/Habitat/Apache2/Template.pm  
line 69.\n


Line 69:
$r-print( $output ) if $output;

Where $r is Apache2::RequestRec

Any ideas?  It was working fine yesterday, the only thing different  
is the debugger now,
and I even have it remarked out and still get this error.  It doesn't  
make any sense to me.

Why would Apache2:RequestRec loose the print subroutine?



Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Jul 1, 2006, at 1:36 AM, Boysenberry Payne wrote:

I'm not sure what your doing that you need to be running setgid  
though.


Me either.
Do any of these require setgid that you know of?

use APR::Pool ();
use Apache::DB ();
Apache::DB-init();

use Apache::DBI ();
use Apache2::Connection ();
use Apache2::Const -compile = qw( OK REDIRECT FORBIDDEN );
use Apache2::Cookie ();
use Apache2::Request ();
use Apache2::Upload ();
use APR::Request::Apache2 ();
use Email::Send ();
use HTML::TreeBuilder ();
use Template ();
use URI::Escape ();

I used egrep on all of my custom modules and came up with nothing.
I says during install_driver(mysql)  would it be from changing  
databases,
e.g. starting in one database/user than switching to another  
database/user?



Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com


On Jun 30, 2006, at 6:36 PM, Philip M. Gollucci wrote:


Boysenberry Payne wrote:

That helped me get the Debugger working thank you.
Now its cutting out with this error in the error log:
[Fri Jun 30 17:55:23 2006] [error] [client 127.0.0.1]  
install_driver(mysql) failed: Insecure $ENV{PATH} while running  
setgid at  
/Library/Perl/5.8.1/darwin-thread-multi-2level/Term/ReadKey.pm  
line 334.\nCompilation failed in require at  
/Library/Perl/5.8.1/Term/ReadLine/Perl.pm line 58.\n\n at  
/Users/boysie/habitat/perl/modules/Habitat/Apache2/DB.pm line 39\n

How come its saying the $ENV{PATH} is insecure?
Any ideas?

perldoc perlsec.

By default path is tainted unless you untaint it.

I'm not sure what your doing that you need to be running setgid  
though.



--  
 


Philip M. Gollucci ([EMAIL PROTECTED]) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

In all that I've done wrong I know I must have done something  
right to

deserve a hug every morning and butterfly kisses at night.


















Is Apache::DB still the way to interactively debug via MP2

2006-06-30 Thread Boysenberry Payne

Are the instructions as:
Home / Documentation / 1.0 / mod_perl 1.0 User Guide /
Still valid for MP2?  I can't find anything in the MP2 docs...

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com



Re: Is Apache::DB still the way to interactively debug via MP2

2006-06-30 Thread Boysenberry Payne

When I follow the example, using Apache2::Status instead of
Apache::Status I get the following at the prompt:


root# httpd -X -D PERLDB
Processing config directory: /private/etc/httpd/users/*.conf
 Processing config file: /private/etc/httpd/users/boysie.conf

Instead of the expected:
[notice] Apache::DB initialized in child 950

When I do apachectl start I get the following:

root# apachectl start
[notice] Apache::DB initialized in child 1441
Syntax error on line 74 of /Users/boysie/habitat/apache/conf/perl.conf:
mod_perl is already running, too late for PerlSwitches

I must be doing something wrong.  I'm using the following:

Apache/2.0.55
perl5 (revision 5.0 version 8 subversion 1 RC3)
OS X 10.3.9
MP2.02

Here is my config:

Perl
use Apache::DB ();
Apache::DB-init;
/Perl
Location /
PerlFixupHandler Apache::DB
/Location

PerlModule Apache2::Status
Location /perl-status
PerlResponseHandler Apache2::Status
SetHandler perl-script
/Location

I am using mod-rewrite too, would that effect the outcome?


Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Jun 30, 2006, at 1:07 PM, Perrin Harkins wrote:


On Fri, 2006-06-30 at 12:57 -0500, Boysenberry Payne wrote:

Are the instructions as:
Home / Documentation / 1.0 / mod_perl 1.0 User Guide /
Still valid for MP2?  I can't find anything in the MP2 docs...


The Apache::DB docs say it supports mod_perl 2.

- Perrin







Re: Is Apache::DB still the way to interactively debug via MP2

2006-06-30 Thread Boysenberry Payne

That helped me get the Debugger working thank you.

Now its cutting out with this error in the error log:
[Fri Jun 30 17:55:23 2006] [error] [client 127.0.0.1]  
install_driver(mysql) failed: Insecure $ENV{PATH} while running setgid  
at /Library/Perl/5.8.1/darwin-thread-multi-2level/Term/ReadKey.pm line  
334.\nCompilation failed in require at  
/Library/Perl/5.8.1/Term/ReadLine/Perl.pm line 58.\n\n at  
/Users/boysie/habitat/perl/modules/Habitat/Apache2/DB.pm line 39\n


How come its saying the $ENV{PATH} is insecure?
Any ideas?

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Jun 30, 2006, at 4:38 PM, Philip M. Gollucci wrote:


Boysenberry Payne wrote:

[notice] Apache::DB initialized in child 1441
Syntax error on line 74 of  
/Users/boysie/habitat/apache/conf/perl.conf:

mod_perl is already running, too late for PerlSwitches
I must be doing something wrong.  I'm using the following:
Apache/2.0.55
perl5 (revision 5.0 version 8 subversion 1 RC3)
OS X 10.3.9
MP2.02
Here is my config:
Perl
use Apache::DB ();
Apache::DB-init;
/Perl
Location /
PerlFixupHandler Apache::DB
/Location

you need a small 3 line db.pl
file at startup under mod_perl2.  That error is from something  
unrelated in your config.

http://search.cpan.org/~fwiles/Apache-DB-0.13/DB.pm

see the init section there.

I use it all the time, and it works fine.

Frank Wiles reads this list regular and is a mp docs committer as well.

--  
--- 
-

Philip M. Gollucci ([EMAIL PROTECTED]) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

It takes a minute to have a crush on someone, an hour to like someone,
and a day to love someone, but it takes a lifetime to forget  
someone...







Off-line mod_perl documentation

2006-04-17 Thread Boysenberry Payne
Does anyone have any suggestions on how to go about getting the 
mod_perl documentation
setup for local viewing.  I'm trying to keep this from being an 
all-day project.  I want
to be able to get at the mp2 docs off-line or locally.  It would be 
nice if it was html too

rather than the less usable PDF type.

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com



Getting error on apache2 restart with TemplateToolkit

2006-03-17 Thread Boysenberry Payne
I'm using apache v2/mod_perl v2/perl v5.8.1/OS X 
v10.3.9/TemplateToolkit v2.14


I get the following error on apachectl restart:

v-strings are deprecated at 
/Library/Perl/5.8.1/darwin-thread-multi-2level/Template/Document.pm 
line 41.
v-strings are deprecated at 
/Library/Perl/5.8.1/darwin-thread-multi-2level/Template/Document.pm 
line 45.


The Document.pm is using $^V.  What can I do to get rid of this?  Is it 
something to worry about?
Should I turn warnings off on the production server and not worry about 
it on my development server.
Or should I do something else entirely?  I'm trying not to have to 
rebuild perl on OSX I've noticed a lot

of abnormalities when doing it once before.

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com



Re: Modperl2 question

2006-03-13 Thread Boysenberry Payne
Since we're on the subject of CGI vs libapreq.  I've moved to using 
Apache2::Request
and APache2::Cookie with no problems.   Now I'm wondering if there 
isn't an equivalent
for the rest of what CGI.pm offers.  In particular, I wondering about 
it's html tag output.
Are there any Apache2 equivalents?  If not, are there other modules 
that will do the same
but only concentrate on the html output (javascript would be nice too?) 
 I'm hoping to
not have to compile the CGI module.  My RSHRD = 23.1 M already.  I'm 
guessing that's

pretty big.  Any ideas?

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Mar 12, 2006, at 10:34 PM, Foo Ji-Haw wrote:



Sure, libapreq and its included modules are the fastest way to parse 
parameters and handle cookies.  However, hardly anyone needs that 
speed.  Most people are spending all of their time talking to a 
database or doing other I/O tasks, or have pretty minimal web 
traffic, or both.
That's true. I spend more time optimising the database and the web ui 
then anything.


If you're writing something new, and you don't care about supporting 
CGI, and you want to use the fastest option, by all means give 
libapreq a try.  For most people though, it won't make any measurable 
difference which one you use.  I wouldn't advise anyone to bother 
changing CGI.pm code unless they've run a profiler and seen it show 
up high enough to matter.
Apache2::Request, and Apache2::Cookie looks like compatible 
replacements to CGI and CGI::Cookie. I think that's the objective 
anyway, so that when the need arises, it's just a simple replacement 
from the root function call (assuming factoring has been done). I 
think the difference will be whether the web application is a high 
traffic site-low cpu site, or a high cpu-low traffic one. The 
performance gain for the former will be more significant.









Quick MP2 install questions

2006-02-23 Thread Boysenberry Payne
I have a couple of question while installing MP2 over again.

Do I have to enable MP_DEBUG and MP_TRACE in order to debug
or trace; does that mean I'll be stuck with everything being debugged or
traced?

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com


Re: A question for the newbies

2006-02-16 Thread Boysenberry Payne
I guess I'm still considered a mod_perl / perl newbie.  I started 
learning perl 6 months
ago in anticipation of translating a CMS (Content Management System) I 
wrote in PHP.


I considered Python, and  C++ as alternatives.  C++ was over kill and 
would require
way too much development just to get going (why reinvent the wheel if I 
don't have to.)
Python, seemed too similar to PHP for my tastes.  I don't like being 
forced to use
someone else's coding conventions unless I know there are valid reasons 
for it.
With what I read about Python's white space issues, I thought it might 
be more

tedious, rather than easier to maintain my 50+ files of code.

Once I started looking into perl I was blown away.  Not only has perl 
been the swiss
army knife of system administration for well over 10 years, but 
mod_perl blows the

socks off of php.

So for my particular project I couldn't find a better solution.

I think the hardest part about learning perl (coming from developing in
php for 5 years) was the odd mix of syntax.  It's a mixture of a couple 
of

languages.  Because I was new to unix and shell syntax it was a bit of
time before I started to feel comfortable.  Considering 70% of the 
internet

is run off of *nix flavored servers it's not a bad skill to have.

The benefits of having moved to perl from php are too many to count.
Just the efficiency of perl's string manipulation cut my code down by
up-to 50% in some cases.  Perls abilities to be used both procedurally
as well Object Oriented makes it easy for me to use it which ever way
is most useful for my task.

Moving from PHP to Perl has been the smartest move I've made.  Our
code is more secure (we use a proxy system to keep it completely 
separate
from our client's file server.)  Our system is more stable and 
responsive.

And my code is 100% easier to maintain.

Although I could have used Python or even stuck with PHP and 
accomplished
most of what I'm doing, it would take more time, and wouldn't be nearly 
as much
fun.  In my situation (building a CMS without funding, etc.) I don't 
think I would
have made it this far without being inspired as I was by perl, mod_perl 
and

all that they can do.

Did I mention CPAN?

My hat is off to the Perl/mod_perl community for giving such an 
opportunity.

When in history has it been so bright?

Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Feb 16, 2006, at 7:41 AM, Clinton Gormley wrote:


It seems to me that a lot of people new to mod_perl and to Perl have
joined this mailing list recently.

And this is during a period when popular opinion (amongst those who 
know

no better) seems to regard Perl as antiquated.

I'm delighted that new people are joining.

My question is, what prompted you? What made you choose Perl above
Java/.Net/Python/Ruby etc etc

Do you have experience of those languages? What appeals to you about
Perl? And how do you find your community experience/support compared to
the other languages you know?

clint








Re: I'm getting max connection errors for Apache::DBI

2006-02-10 Thread Boysenberry Payne

Sorry about the extra posts I was having email difficulties that day...

Everything is working fine now though.  The AutoCommit = 0 fixed it 
all...


Thanks again for all of the help,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Feb 8, 2006, at 11:55 AM, Boysenberry Payne wrote:


I took out the flags and the disconnect.  I also set:
$Apache::DBI::DEBUG = 2;
to get debugging output.

I'm not getting any connection errors. (going to set mysql's max 
connections to 150 per server)


What I'm seeing is 37 mysql threads being created for 7 apache 
children.  It would seem as
though I would need to create a 5/1 ratio of mysql connections to 
apache children.  Is that normal?


Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Feb 8, 2006, at 9:59 AM, Perrin Harkins wrote:


Boysenberry Payne wrote:

What do I need to do to fix it?


You probably just need to raise the maximum number of connections on 
your MySQL servers.


If you use two different database servers then you should be seeing a 
total number of connections on each one that matches the number of 
child processes running on your mod_perl server.


$self-{flags} = { 'AutoCommit' = 1, 'RaiseError' = 1 } unless 
$self-{flags};


Connecting with different options sometimes will lead to opening more 
connections rather than using an existing one.  You may want to 
always connect with the same flags and then change them on the 
returned connection instead.  You can use the Apache::DBI debugging 
switch to see if connections are being reused or not.



if( $self-{db} ) {
my $h = $self-{db}-{dbh};
$h-disconnect if $h;


That is pointless, since Apache::DBI doesn't allow disconnects.

- Perrin










Re: read query params

2006-02-10 Thread Boysenberry Payne
x-tad-biggerP.S./x-tad-bigger
x-tad-biggerWith the modification that you made for mod_perl2 you will loose a lot of perl programmer and I doubt that you will get new ones./x-tad-bigger
x-tad-bigger /x-tad-bigger

I think you might be mistaken here.  

I love MP2 even though I've had my fair share or issues to work out with it.
The new Apache hooks are fabulous.  I was able to cut my code down considerably
from the MP1 versions of my code.  It's nice to not have to rely entirely on CGI.pm
to get cookies and posts taken care of anymore.  Much cleaner system.

I hope the developers keep up the great work!

Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Feb 9, 2006, at 11:22 AM, M J wrote:

x-tad-biggerI’m very disappointed regarding the mod_perl 2 documentation and changes that have been made./x-tad-bigger
x-tad-biggerI’m searching for several hours already how can I read the query params using only mod_perl2 API./x-tad-bigger
x-tad-biggerI had problem installing libapreq2-2.06-dev and I’m tired to debug that library./x-tad-bigger
x-tad-biggerI want to use mod_perl2 API to do the simplest job possible: read the parameters sent using GET or POST. I am looping around and I did not find a clear example or explanation regarding this./x-tad-bigger
x-tad-biggerI can use $r->args() but then I need to split that string in order to get my param value. I doubt that this is a good solution./x-tad-bigger
x-tad-bigger /x-tad-bigger
x-tad-biggerP.S./x-tad-bigger
x-tad-biggerWith the modification that you made for mod_perl2 you will loose a lot of perl programmer and I doubt that you will get new ones./x-tad-bigger
x-tad-bigger /x-tad-bigger
x-tad-biggerM J/x-tad-bigger

Brings words and photos together (easily) with
PhotoMail  - it's free and works with Yahoo! Mail.

Re: I'm getting max connection errors for Apache::DBI

2006-02-10 Thread Boysenberry Payne
The name is a blessing and a curse, certainly helps people to remember me.
My parent get a big chuckle out of it still; they really got me good with that one.
;)


Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Feb 10, 2006, at 2:20 PM, Mark Galbreath wrote:

x-tad-biggerThat's alright...it's Friday and no one was sending any jokes, anyway.  And I was getting a chuckle out of your name./x-tad-bigger
x-tad-bigger /x-tad-bigger
x-tad-biggermark/x-tad-bigger

x-tad-bigger>>> Boysenberry Payne [EMAIL PROTECTED]> 10-Feb-06 13:30:46 PM >>>/x-tad-bigger
x-tad-biggerSorry about the extra posts I was having email difficulties that day.../x-tad-bigger

x-tad-biggerEverything is working fine now though.  The AutoCommit = 0 fixed it /x-tad-bigger
x-tad-biggerall.../x-tad-bigger

x-tad-biggerThanks again for all of the help,/x-tad-bigger
x-tad-biggerBoysenberry/x-tad-bigger

x-tad-biggerboysenberrys.com | habitatlife.com | selfgnosis.com/x-tad-bigger

x-tad-biggerOn Feb 8, 2006, at 11:55 AM, Boysenberry Payne wrote:/x-tad-bigger

x-tad-bigger> I took out the flags and the disconnect.  I also set:/x-tad-bigger
x-tad-bigger> $Apache::DBI::DEBUG = 2;/x-tad-bigger
x-tad-bigger> to get debugging output./x-tad-bigger
x-tad-bigger>/x-tad-bigger
x-tad-bigger> I'm not getting any connection errors. (going to set mysql's max /x-tad-bigger
x-tad-bigger> connections to 150 per server)/x-tad-bigger
x-tad-bigger>/x-tad-bigger
x-tad-bigger> What I'm seeing is 37 mysql threads being created for 7 apache /x-tad-bigger
x-tad-bigger> children.  It would seem as/x-tad-bigger
x-tad-bigger> though I would need to create a 5/1 ratio of mysql connections to /x-tad-bigger
x-tad-bigger> apache children.  Is that normal?/x-tad-bigger
x-tad-bigger>/x-tad-bigger
x-tad-bigger> Thanks,/x-tad-bigger
x-tad-bigger> Boysenberry/x-tad-bigger
x-tad-bigger>/x-tad-bigger
x-tad-bigger> boysenberrys.com | habitatlife.com | selfgnosis.com/x-tad-bigger
x-tad-bigger>/x-tad-bigger
x-tad-bigger> On Feb 8, 2006, at 9:59 AM, Perrin Harkins wrote:/x-tad-bigger
x-tad-bigger>/x-tad-bigger
x-tad-bigger>> Boysenberry Payne wrote:/x-tad-bigger
x-tad-bigger>>> What do I need to do to fix it?/x-tad-bigger
x-tad-bigger>>/x-tad-bigger
x-tad-bigger>> You probably just need to raise the maximum number of connections on /x-tad-bigger
x-tad-bigger>> your MySQL servers./x-tad-bigger
x-tad-bigger>>/x-tad-bigger
x-tad-bigger>> If you use two different database servers then you should be seeing a /x-tad-bigger
x-tad-bigger>> total number of connections on each one that matches the number of /x-tad-bigger
x-tad-bigger>> child processes running on your mod_perl server./x-tad-bigger
x-tad-bigger>>/x-tad-bigger
x-tad-bigger>>> $self->{flags} = { 'AutoCommit' => 1, 'RaiseError' => 1 } unless/x-tad-bigger
x-tad-bigger>>> $self->{flags};/x-tad-bigger
x-tad-bigger>>/x-tad-bigger
x-tad-bigger>> Connecting with different options sometimes will lead to opening more /x-tad-bigger
x-tad-bigger>> connections rather than using an existing one.  You may want to /x-tad-bigger
x-tad-bigger>> always connect with the same flags and then change them on the /x-tad-bigger
x-tad-bigger>> returned connection instead.  You can use the Apache::DBI debugging /x-tad-bigger
x-tad-bigger>> switch to see if connections are being reused or not./x-tad-bigger
x-tad-bigger>>/x-tad-bigger
x-tad-bigger>>> if( $self->{db} ) {/x-tad-bigger
x-tad-bigger>>> my $h = $self->{db}->{dbh};/x-tad-bigger
x-tad-bigger>>> $h->disconnect if $h;/x-tad-bigger
x-tad-bigger>>/x-tad-bigger
x-tad-bigger>> That is pointless, since Apache::DBI doesn't allow disconnects./x-tad-bigger
x-tad-bigger>>/x-tad-bigger
x-tad-bigger>> - Perrin/x-tad-bigger
x-tad-bigger>>/x-tad-bigger
x-tad-bigger>>/x-tad-bigger
x-tad-bigger>/x-tad-bigger
x-tad-bigger>/x-tad-bigger
x-tad-bigger>/x-tad-bigger



Re: I'm getting max connection errors for Apache::DBI

2006-02-09 Thread Boysenberry Payne
The only difference in each connection is the database.  I tried connecting
to the same database then using $h-do( USE new_database );  But it doesn't
switch to the new database (works fine using DBI.)

I decided as a temporary hack I'd try the following:

sub clean_processes {

my $self = shift;
my $dbs = $self->{dbs};
my $h = $dbs->{local};
my $sth = $h->prepare( SHOW FULL PROCESSLIST ) or warn error  . $h->errstr;
$sth->execute or warn error  . $h->errstr;
my $tbl_ary_ref = $sth->fetchall_arrayref({});
return unless( int( @$tbl_ary_ref ) > 50 );
foreach( @$tbl_ary_ref ) {
if( $_->{Command} ) {
if( ( $_->{Command} eq Sleep ) || ( $_->{Command} eq Killed ) ) {
if( $_->{Time} ) {
warn Killing ID: $_->{Id} USER: $_->{User} DB: $_->{db};
my $sth2 = $h->prepare( KILL $_->{Id} ) or warn error  . $h->errstr;
$sth2->execute or warn error  . $h->errstr;
}
}
}
}
return;
}

Not only does it not kill the processes, but it stops allowing for a connection to any database giving the following error:
[error] [client 127.0.0.1] DBD driver has not implemented the AutoCommit attribute at /usr/local/lib/perl5/site_perl/5.8.7/Apache/DBI.pm line 250.\n, referer: http://127.0.0.1/web_address/

When I watch the error_log and the 	$Apache::DBI::DEBUG = 2 I get one of the two following:
need ping: yes
12844 Apache::DBI new connect to 'database=boysie_habitat;host=localhostrooth1jAcK36AutoCommit=1PrintError=1RaiseError=1Username=root'
12844 Apache::DBI disconnect (overloaded) 
or:
need ping: yes
12848 Apache::DBI already connected to 'database=boysie_habitat;host=localhostUsernamePasswordAutoCommit=1PrintError=1RaiseError=1Username=root'
12848 Apache::DBI disconnect (overloaded)

I will be a list of them 5 at a time (I'm guessing one for each child.)  Then as long as I only use that database no problem.  As soon
as I switch databases which is the only thing that changes in my new connections, I spawns all new database threads.  So if I have
100 databases to connect to I get ( 100 * as many child apache process as the requests came in on).  I don't think setting my max
connections 700+ makes sense especially since the remaining connections are shown as sleeping.

Is there a way to connect to more than one database without spawning extra mysql connections?
Also, my local development is on OSX, where as my production environment is Red Hat Linux.
I'm using Apache2 and MP2 for both, only proxy in the production environment though.


PS For some reason my email responses aren't making it to the list, sorry...

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Feb 8, 2006, at 6:22 PM, Perrin Harkins wrote:

On Wed, 2006-02-08 at 11:51 -0600, Boysenberry Payne wrote:
What I'm seeing is 37 mysql threads being created for 7 apache 
children.  It would seem as
though I would need to create a 5/1 ratio of mysql connections to 
apache children.  Is that normal?

No.  If you use the same connection info every time, you should only see
one connection per child.  If you have two databases, you should see two
connections per child.  Maybe you are still not using the same connect
string each time?  The debug output should tell you if it thinks it has
a connection already or not.

- Perrin





Re: I'm getting max connection errors for Apache::DBI

2006-02-09 Thread Boysenberry Payne
I got rid of the disconnect, duh.  I still have the errors, but no longer get the
12844 Apache::DBI disconnect (overloaded) 

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Feb 9, 2006, at 9:14 AM, Boysenberry Payne wrote:

The only difference in each connection is the database.  I tried connecting
to the same database then using $h-do( USE new_database );  But it doesn't
switch to the new database (works fine using DBI.)

I decided as a temporary hack I'd try the following:

sub clean_processes {

my $self = shift;
my $dbs = $self->{dbs};
my $h = $dbs->{local};
my $sth = $h->prepare( SHOW FULL PROCESSLIST ) or warn error  . $h->errstr;
$sth->execute or warn error  . $h->errstr;
my $tbl_ary_ref = $sth->fetchall_arrayref({});
return unless( int( @$tbl_ary_ref ) > 50 );
foreach( @$tbl_ary_ref ) {
if( $_->{Command} ) {
if( ( $_->{Command} eq Sleep ) || ( $_->{Command} eq Killed ) ) {
if( $_->{Time} ) {
warn Killing ID: $_->{Id} USER: $_->{User} DB: $_->{db};
my $sth2 = $h->prepare( KILL $_->{Id} ) or warn error  . $h->errstr;
$sth2->execute or warn error  . $h->errstr;
}
}
}
}
return;
}

Not only does it not kill the processes, but it stops allowing for a connection to any database giving the following error:
[error] [client 127.0.0.1] DBD driver has not implemented the AutoCommit attribute at /usr/local/lib/perl5/site_perl/5.8.7/Apache/DBI.pm line 250.\n, referer: http://127.0.0.1/web_address/

When I watch the error_log and the 	$Apache::DBI::DEBUG = 2 I get one of the two following:
need ping: yes
12844 Apache::DBI new connect to 'database=boysie_habitat;host=localhostrooth1jAcK36AutoCommit=1PrintError=1RaiseError=1Username=root'
12844 Apache::DBI disconnect (overloaded) 
or:
need ping: yes
12848 Apache::DBI already connected to 'database=boysie_habitat;host=localhostUsernamePasswordAutoCommit=1PrintError=1RaiseError=1Username=root'
12848 Apache::DBI disconnect (overloaded)

I will be a list of them 5 at a time (I'm guessing one for each child.)  Then as long as I only use that database no problem.  As soon
as I switch databases which is the only thing that changes in my new connections, I spawns all new database threads.  So if I have
100 databases to connect to I get ( 100 * as many child apache process as the requests came in on).  I don't think setting my max
connections 700+ makes sense especially since the remaining connections are shown as sleeping.

Is there a way to connect to more than one database without spawning extra mysql connections?
Also, my local development is on OSX, where as my production environment is Red Hat Linux.
I'm using Apache2 and MP2 for both, only proxy in the production environment though.


PS For some reason my email responses aren't making it to the list, sorry...

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Feb 8, 2006, at 6:22 PM, Perrin Harkins wrote:

On Wed, 2006-02-08 at 11:51 -0600, Boysenberry Payne wrote:
What I'm seeing is 37 mysql threads being created for 7 apache 
children.  It would seem as
though I would need to create a 5/1 ratio of mysql connections to 
apache children.  Is that normal?

No.  If you use the same connection info every time, you should only see
one connection per child.  If you have two databases, you should see two
connections per child.  Maybe you are still not using the same connect
string each time?  The debug output should tell you if it thinks it has
a connection already or not.

- Perrin





Re: I'm getting max connection errors for Apache::DBI

2006-02-09 Thread Boysenberry Payne
Ok I switched to using fully qualified database requests as:
database_name.table_name and received the following errors:


8854 Apache::DBI need ping: yes
8854 Apache::DBI new connect to 'database=adm_accounts;host=localhostNamePassAutoCommit=1PrintError=1RaiseError=1Username=Name'

DBD::mysql::st execute failed: Table 'boysie_habtiat.sessions' doesn't exist at /Users/boysie/mod_perl_inc/Habitat/DB/Select.pm line 95.
Failed uni_select Execute Query: SELECT session, time FROM boysie_habtiat.sessions WHERE NOW() > time ORDER BY time Error: Table 'boysie_habtiat.sessions' doesn't exist at /Users/boysie/mod_perl_inc/Habitat/DB/Select.pm line 96.


So it seems like it wont let me get into another database...

Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Feb 9, 2006, at 9:35 AM, Tom Schindl wrote:

What if you'd write all your SQL-Statements in a fully qualified manner?

---8---
SELECT * FROM $DB1.$TABLE1;
SELECT * FROM $DB2.$TABLE1;
---8---

Tom


Boysenberry Payne wrote:
The only difference in each connection is the database. I tried connecting
to the same database then using $h-do( USE new_database ); But it doesn't
switch to the new database (works fine using DBI.)

*I decided as a temporary hack I'd try the following:*

sub clean_processes {

my $self = shift;
my $dbs = $self->{dbs};
my $h = $dbs->{local};
my $sth = $h->prepare( SHOW FULL PROCESSLIST ) or warn error  .
$h->errstr;
$sth->execute or warn error  . $h->errstr;
my $tbl_ary_ref = $sth->fetchall_arrayref({});
return unless( int( @$tbl_ary_ref ) > 50 );
foreach( @$tbl_ary_ref ) {
if( $_->{Command} ) {
if( ( $_->{Command} eq Sleep ) || ( $_->{Command} eq Killed ) ) {
if( $_->{Time} ) {
warn Killing ID: $_->{Id} USER: $_->{User} DB: $_->{db};
my $sth2 = $h->prepare( KILL $_->{Id} ) or warn error  . $h->errstr;
$sth2->execute or warn error  . $h->errstr;
}
}
}
}
return;
}

*Not only does it not kill the processes, but it stops allowing for a
connection to any database giving the following error:*
[error] [client 127.0.0.1] DBD driver has not implemented the AutoCommit
attribute at /usr/local/lib/perl5/site_perl/5.8.7/Apache/DBI.pm line
250.\n, referer: http://127.0.0.1/web_address/

*When I watch the error_log and the $Apache::DBI::DEBUG = 2 I get one of
the two following:*
need ping: yes
12844 Apache::DBI new connect to
'database=boysie_habitat;host=localhostrooth1jAcK36AutoCommit=1PrintError=1RaiseError=1Username=root'

12844 Apache::DBI disconnect (overloaded)
*or:*
need ping: yes
12848 Apache::DBI already connected to
'database=boysie_habitat;host=localhostUsernamePasswordAutoCommit=1PrintError=1RaiseError=1Username=root'

12848 Apache::DBI disconnect (overloaded)

I will be a list of them 5 at a time (I'm guessing one for each child.)
Then as long as I only use that database no problem. As soon
as I switch databases which is the only thing that changes in my new
connections, I spawns all new database threads. So if I have
100 databases to connect to I get ( 100 * as many child apache process
as the requests came in on). I don't think setting my max
connections 700+ makes sense especially since the remaining connections
are shown as sleeping.

Is there a way to connect to more than one database without spawning
extra mysql connections?
Also, my local development is on OSX, where as my production environment
is Red Hat Linux.
I'm using Apache2 and MP2 for both, only proxy in the production
environment though.


PS For some reason my email responses aren't making it to the list,
sorry...

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Feb 8, 2006, at 6:22 PM, Perrin Harkins wrote:

On Wed, 2006-02-08 at 11:51 -0600, Boysenberry Payne wrote:

What I'm seeing is 37 mysql threads being created for 7 apache
children. It would seem as
though I would need to create a 5/1 ratio of mysql connections to
apache children. Is that normal?


No. If you use the same connection info every time, you should only see
one connection per child. If you have two databases, you should see two
connections per child. Maybe you are still not using the same connect
string each time? The debug output should tell you if it thinks it has
a connection already or not.

- Perrin






Re: I'm getting max connection errors for Apache::DBI

2006-02-09 Thread Boysenberry Payne
After reading up on Apache::DBI::Cache it seems like it might solve the 
issues, thanks.


I'll reply again if it doesn't...

Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Feb 9, 2006, at 10:03 AM, Torsten Foertsch wrote:


On Thursday 09 February 2006 16:14, you wrote:
I will be a list of them 5 at a time (I'm guessing one for each 
child.)  

  Then as long as I only use that database no problem.  As soon
as I switch databases which is the only thing that changes in my new  
connections, I spawns all new database threads.  So if I have
100 databases to connect to I get ( 100 * as many child apache 
process  

as the requests came in on).  I don't think setting my max
connections 700+ makes sense especially since the remaining 
connections  

are shown as sleeping.

Is there a way to connect to more than one database without spawning  
extra mysql connections?


I have not followed the thread. But

1) Apache::DBI::Cache could be of some help. Read the description 
carefully.

It differs from Apache::DBI in when handles are cached.

2) Do you know that the DBD::mysql driver has a auto_reconnect 
feature. If a
handle has AutoCommit=1 and is running under mod_perl this is turned 
on by
default. But the driver does not follow use database statements. 
Hence,
once the mysql connection is lost the automatic reconnect is done to 
the

database passed to the original DBI-connect. This hurt me badly while
developing Apache::DBI::Cache::mysql causing similar problems.

Torsten




Re: I'm getting max connection errors for Apache::DBI

2006-02-09 Thread Boysenberry Payne

What are the ramifications of making AutoCommit = 0?
It going to bite me in the but later?

What are the pros and cons of using Apache::DBI::Cache over
Apache::DBI?

Thank for all of the help so far...
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Feb 9, 2006, at 12:11 PM, Boysenberry Payne wrote:

After reading up on Apache::DBI::Cache it seems like it might solve 
the issues, thanks.


I'll reply again if it doesn't...

Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Feb 9, 2006, at 10:03 AM, Torsten Foertsch wrote:


On Thursday 09 February 2006 16:14, you wrote:
I will be a list of them 5 at a time (I'm guessing one for each 
child.)  

  Then as long as I only use that database no problem.  As soon
as I switch databases which is the only thing that changes in my new 
 

connections, I spawns all new database threads.  So if I have
100 databases to connect to I get ( 100 * as many child apache 
process  

as the requests came in on).  I don't think setting my max
connections 700+ makes sense especially since the remaining 
connections  

are shown as sleeping.

Is there a way to connect to more than one database without spawning 
 

extra mysql connections?


I have not followed the thread. But

1) Apache::DBI::Cache could be of some help. Read the description 
carefully.

It differs from Apache::DBI in when handles are cached.

2) Do you know that the DBD::mysql driver has a auto_reconnect 
feature. If a
handle has AutoCommit=1 and is running under mod_perl this is turned 
on by
default. But the driver does not follow use database statements. 
Hence,
once the mysql connection is lost the automatic reconnect is done to 
the

database passed to the original DBI-connect. This hurt me badly while
developing Apache::DBI::Cache::mysql causing similar problems.

Torsten








Re: I'm getting max connection errors for Apache::DBI

2006-02-09 Thread Boysenberry Payne
You're right it was a typo.  Now that it's fixed it works using the do( 
USE database_name) syntax

with AutoCommit = 0

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Feb 9, 2006, at 12:02 PM, Clinton Gormley wrote:




DBD::mysql::st execute failed: Table 'boysie_habtiat.sessions' doesn't
exist at /Users/boysie/mod_perl_inc/Habitat/DB/Select.pm line 95.
Failed uni_select Execute Query: SELECT session, time FROM
boysie_habtiat.sessions WHERE NOW()  time ORDER BY time Error: Table
'boysie_habtiat.sessions' doesn't exist
at /Users/boysie/mod_perl_inc/Habitat/DB/Select.pm line 96.



It definitely works - you have a typo somewhere.







I'm getting max connection errors for Apache::DBI

2006-02-09 Thread Boysenberry Payne
I'm using Apache/2.0.54 (Unix) mod_apreq2-20050712/2.1.3-dev mod_perl/2.0.1 Perl/v5.8.0

After a certain level of usage I get the following error:

failed: Too many connections at /usr/lib/perl5/5.8.0/Habitat/Apache2/DB.pm line 64\n,


When I do a server restart it's fine for a while.  What do I need to do to fix it?  I'm sure there are many ways
depending on what's creating the problem.  Currently mod_perl is proxied to from another server.
I have about 100+ databases that need reoccurring lookups from mod_perl.  It seems fine but builds sleeping
connections, since each apache child requires two connections.  One to a local server, one to external.


So here is what I'm using to create connections to my mysql database:

$self->{flags} = { 'AutoCommit' => 1, 'RaiseError' => 1 } unless $self->{flags};

my $log = $self->{log}->{local};
$self->{db}->{dbh} = DBI->connect( DBI:mysql:$db=$log->{$db};$h=$log->{$h}, $log->{user}, $log->{pass}, $self->{flags} )
or $out->( Error Connecting Local DB: \n$DBI::errstr );
$log = $self->{log}->{external};
$self->{db}->{dbs}->{external} = DBI->connect( DBI:mysql:$db=$log->{$db};$h=$log->{$h}, $log->{user}, $log->{pass}, $self->{flags} )
or $out->( Error Connecting External: \n$DBI::errstr );


at the end of usage I use:

if( $self->{db} ) {
my $h = $self->{db}->{dbh};
$h->disconnect if $h;
my $ext = $self->{db}->{dbs}->{external} if( $self->{db}->{dbs} );
$ext->disconnect if $ext;
delete $self->{db};
}

Is this more of a mysql question/issue?


Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com


Re: I'm getting max connection errors for Apache::DBI

2006-02-09 Thread Boysenberry Payne

I took out the flags and the disconnect.  I also set:
$Apache::DBI::DEBUG = 2;
to get debugging output.

I'm not getting any connection errors. (going to set mysql's max 
connections to 150 per server)


What I'm seeing is 37 mysql threads being created for 7 apache 
children.  It would seem as
though I would need to create a 5/1 ratio of mysql connections to 
apache children.  Is that normal?


Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Feb 8, 2006, at 9:59 AM, Perrin Harkins wrote:


Boysenberry Payne wrote:

What do I need to do to fix it?


You probably just need to raise the maximum number of connections on 
your MySQL servers.


If you use two different database servers then you should be seeing a 
total number of connections on each one that matches the number of 
child processes running on your mod_perl server.


$self-{flags} = { 'AutoCommit' = 1, 'RaiseError' = 1 } unless 
$self-{flags};


Connecting with different options sometimes will lead to opening more 
connections rather than using an existing one.  You may want to always 
connect with the same flags and then change them on the returned 
connection instead.  You can use the Apache::DBI debugging switch to 
see if connections are being reused or not.



if( $self-{db} ) {
my $h = $self-{db}-{dbh};
$h-disconnect if $h;


That is pointless, since Apache::DBI doesn't allow disconnects.

- Perrin






Re: I'm getting max connection errors for Apache::DBI

2006-02-09 Thread Boysenberry Payne

I took out the flags and the disconnect.  I also set:
$Apache::DBI::DEBUG = 2;
to get debugging output.

I'm not getting any connection errors. (going to set mysql's max 
connections to 150 per server)


What I'm seeing is 37 mysql threads being created for 7 apache 
children.  It would seem as
though I would need to create a 5/1 ratio of mysql connections to 
apache children.  Is that normal?


Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Feb 8, 2006, at 9:59 AM, Perrin Harkins wrote:


Boysenberry Payne wrote:

What do I need to do to fix it?


You probably just need to raise the maximum number of connections on 
your MySQL servers.


If you use two different database servers then you should be seeing a 
total number of connections on each one that matches the number of 
child processes running on your mod_perl server.


$self-{flags} = { 'AutoCommit' = 1, 'RaiseError' = 1 } unless 
$self-{flags};


Connecting with different options sometimes will lead to opening more 
connections rather than using an existing one.  You may want to always 
connect with the same flags and then change them on the returned 
connection instead.  You can use the Apache::DBI debugging switch to 
see if connections are being reused or not.



if( $self-{db} ) {
my $h = $self-{db}-{dbh};
$h-disconnect if $h;


That is pointless, since Apache::DBI doesn't allow disconnects.

- Perrin






I'm getting max connection errors for Apache::DBI

2006-02-07 Thread Boysenberry Payne
I'm using Apache/2.0.54 (Unix) mod_apreq2-20050712/2.1.3-dev mod_perl/2.0.1 Perl/v5.8.0

After a certain level of usage I get the following error:

failed: Too many connections at /usr/lib/perl5/5.8.0/Habitat/Apache2/DB.pm line 64\n,


When I do a server restart it's fine for a while.  What do I need to do to fix it?  I'm sure there are many ways
depending on what's creating the problem.  Currently mod_perl is proxied to from another server.
I have about 100+ databases that need reoccurring lookups from mod_perl.  It seems fine but builds sleeping
connections, since each apache child requires two connections.  One to a local server, one to external.


So here is what I'm using to create connections to my mysql database:

$self->{flags} = { 'AutoCommit' => 1, 'RaiseError' => 1 } unless $self->{flags};

my $log = $self->{log}->{local};
$self->{db}->{dbh} = DBI->connect( DBI:mysql:$db=$log->{$db};$h=$log->{$h}, $log->{user}, $log->{pass}, $self->{flags} )
or $out->( Error Connecting Local DB: \n$DBI::errstr );
$log = $self->{log}->{external};
$self->{db}->{dbs}->{external} = DBI->connect( DBI:mysql:$db=$log->{$db};$h=$log->{$h}, $log->{user}, $log->{pass}, $self->{flags} )
or $out->( Error Connecting External: \n$DBI::errstr );


at the end of usage I use:

if( $self->{db} ) {
my $h = $self->{db}->{dbh};
$h->disconnect if $h;
my $ext = $self->{db}->{dbs}->{external} if( $self->{db}->{dbs} );
$ext->disconnect if $ext;
delete $self->{db};
}

Is this more of a mysql question/issue?


Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com


For those familiar with HTML::TreeBuilder and HTML::Element

2006-02-05 Thread Boysenberry Payne

Hello,

I'm trying to get upper case html with HTML::TreeBuilder via
HTML::Element-as_HTML
via:

# Build HTML Tree
$self-{tree} = HTML::TreeBuilder-new();
my $tree = $self-{tree};

# Parse HTML
$tree-parse( $html );
$tree-eof;

my $new_html = $tree-as_HTML( '', , {} );

$html was:

P ALIGN=LEFTTest/P

$new_html after removing htmlbody tags:

p align=leftTest/p

Is there a way to make it output uppercase html?

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com



Getting keep-alive sorted

2005-12-28 Thread Boysenberry Payne
Hello mod_perl list,

I'm trying to sort out my keep-alive issues.
It would seem to me (can't get my hands on some of my reference materials right now to confirm)
that it's better to have keep-alive off while using a front end (static/php) apache to proxy (using 
mod_rewrite with an .htaccess file) to a back end (mod_perl) apache.

If so how do I do it?  I looked at the mod_perl docs and found:
Apache2::Response->set_keep_alive()

The example:
$ret = $r->set_keepalive();

Doesn't really make sense to me.  I already have the following in my code:

$r->no_cache(1);

What do I do?

Thanks in advance,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com


Re: Filtering and Separation of Presentation Layer

2005-12-26 Thread Boysenberry Payne

I use something similar to this with mod_perl to flash using xml.
Flash then uses xml in a template fashion.  Our templates are
highly configurable this way.

In the near future we will be doing it as mod_perl to ajax.

Unfortunately we haven't decided on how we want to make
our code public yet.  Maybe in the near future...

When we have it doing ajax output, the template mechanisms
will become a lot more visible via javascript.

The nice thing about doing this way is off loading some of the
processing onto the client.

Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Dec 26, 2005, at 10:26 AM, Frank Wiles wrote:


On Mon, 26 Dec 2005 14:17:00 +0100
Joachim Zobel [EMAIL PROTECTED] wrote:


I think it makes sense to use Apache filtering to seperate the
presentation layer. The idea is to have an application layer that
outputs xml and a template engine attached by filtering that merges
the xml into html pages.

What is already there? Are there any template engines that can be
attached through filtering? Is there any spec. for an interface xml?
What are the cons of this approach?


  Separating your application like that is a great idea, most large
  applications do this type of separation inside of the app itself.
  While I haven't heard of anyone doing this in practice, I have at
  times thought about it.

  It would be fairly trivial to write a filter that takes XML input
  and rework it so that it can be passed into a templating engine like
  Template Toolkit.

  The only real drawback is that you've got the extra encode/decode
  cycle going on.  Assuming you gather your data into some complex
  data structure, convert it to XML and then output it.  You then
  have to convert the XML back into a perl data structure and then
  pass it to the template engine. This could cause significant
  performance problems depending on your hardware/traffic.

  If your app interfaces with a lot of various applications, uses
  REST/SOAP/XML-RPC, etc. extensively then it might be more worthwhile
  to do this, allowing you to completely separate your internal
  logic/data from the outside world.

  Another option entirely is using XSLT to do your transformation
  between XML and HTML.  There is a plugin for Template Toolkit for
  this even.

 -
   Frank Wiles [EMAIL PROTECTED]
   http://www.wiles.org
 -







Re: go crazy with me

2005-12-21 Thread Boysenberry Payne
I have Apache 1.33 on my front end and an .htaccess file with the 
following


RewriteRule   
^(.*)habitat[/]?$	http://perl.habitatlife.com:81/habitat.pl [P]


On the back end I have MP2 and Apache2.  How can I be sure keep alive 
is off?

Is it done via the front or back?
Is this the wrong group for this?

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Dec 21, 2005, at 2:10 PM, Randal L. Schwartz wrote:


Fred == Fred Moyer [EMAIL PROTECTED] writes:


Fred Can you explain a bit more why using keep-alives to the backend 
is not
Fred a good thing?  I've always been under the impression from 
conference
Fred lectures and literature that turning keep-alives on for the app 
server
Fred is something you should do to reduce the overhead of creating 
new tcp

Fred connections to the proxy server.

Imagine wanting to have 50 fronts and 10 backs.  If you use keep 
alives,

that'll end up being 50 fronts and 50 backs.

The overhead of reconnecting shouldn't be much of an issue here, 
because
your front and back machines are probably very close together, and the 
cost

of lookup and reverse lookup shouldn't be much.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 
0095

merlyn@stonehenge.com URL: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!







Re: Is $ENV{HTTP_X_FORWARDED_HOST} reliable

2005-12-18 Thread Boysenberry Payne

On Dec 17, 2005, at 5:56 PM, Frank Wiles wrote:


 The best way to do this is to use the virtual hosts on the front
  end to your advantage.  So on the front end you tell the backend
  which domain it came from:

  VirtualHost domain.com:80

ProxyPass / http://localhost:8080/domain.com/
ProxyPassReverse / http://localhost:8080/domain.com/
  /VirtualHost

  By passing in the domain this way you can see where it came from.
  I'm sure there are probably a number of other ways to get this done,
  but that was the first that popped into my head.


Unfortunately I don't have access to the httpd.conf file for the front 
end server.
It's managed, so I don't have root either.  I do have ftp access and an 
.htaccess

file.

On the back end server I have access to the httpd.conf file, but not 
root access.


I build on a locally on Mac OSX 10.3.9 using Apache2/mod_perl2 then 
upload

the static files to the front end and the perl modules to the backend.


  Also, any reason you're writing your own IP restrictions instead of
  just using allow from/deny from in Apache?


I'm writing them myself because they will be a scalable part of my code 
eventually

allowing for IPs dynamically with subscription.

Thanks
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com



Is $ENV{HTTP_X_FORWARDED_HOST} reliable

2005-12-17 Thread Boysenberry Payne

Hello Everyone,

	I'm using a two server system.  Front end Apache 1.33/php4 uses 
mod_proxy

and mod_rewrite to proxy to the back end Apache2/MP2 system.

I was wondering if $ENV{HTTP_X_FORWARDED_HOST} is a reliable way
to determine the domain of the request; or is it easily spoofed?

I'm hoping to use a combination of IP screening like this:

snip
#
# handler for PerlPreConnectionHandler
#
sub handler {
my Apache2::Connection $c = shift;
my $ip = $c-remote_ip;
if( $good_ips{$ip} ) {
return Apache2::Const::OK;
}
warn IP $ip tried to access perl\n;
return Apache2::Const::FORBIDDEN;
}
/snip

where %good_ips is predefined.

With a domain/user name match where the domain is
being derived from $ENV{HTTP_X_FORWARDED_HOST}.

In order for it to work correctly I would need to know both the
IP and Domain were correct.  Is there any inherent risk with
the way I'm getting the information?  The user name is the only
risk I'm willing to risk, which comes from an .htaccess file where
the proxy is called.

TIA,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com



Re: Is $ENV{HTTP_X_FORWARDED_HOST} reliable

2005-12-17 Thread Boysenberry Payne

Using the PerlPreConnectionHandler in my original post they would
only be able to do it from a server in my IP hash and they don't have
telnet access on that server.  But I see your point.

In my situation I have a bunch of domains on a couple of IPs  I mostly
want to make sure they come from those IPs, then find a way to know
which domain the proxy originates from.

Maybe I should have asked is there a more reliable way than using
$ENV{HTTP_X_FORWARDED_HOST} to determine the domain
of an originating proxy request in a two tier system as I described?

Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Dec 17, 2005, at 5:24 PM, Randal L. Schwartz wrote:

Boysenberry == Boysenberry Payne [EMAIL PROTECTED] 
writes:


Boysenberry 	I'm using a two server system.  Front end Apache 
1.33/php4

Boysenberry uses mod_proxy
Boysenberry and mod_rewrite to proxy to the back end Apache2/MP2 
system.


Boysenberry 	I was wondering if $ENV{HTTP_X_FORWARDED_HOST} is a 
reliable way
Boysenberry to determine the domain of the request; or is it easily 
spoofed?


telnet your.server.example.com 80
GET /some/url HTTP/1.0
X-forwarded-for: some-other-host
CR
CR

Yeah, that's tough to spoof. :)

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 
0095

merlyn@stonehenge.com URL: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!







Need help troubleshooting error using Net::SSH::Perl

2005-11-17 Thread Boysenberry Payne

Hello,

I'm on OS X 10.3.9 / AP2 / MP 2 / Perl 5.8.7
I've got a script that connects to a couple of ssh servers using  
Net::SSH::Perl.


I've been able to log onto both servers using SSH in a terminal and  
previously
my script worked for connecting to both servers.  Now, one server gives  
the following errors:


Trying empty user-authentication request.
Uncaught exception from user code:
Connection closed by remote host. at  
/usr/local/lib/perl5/site_perl/5.8.7/Net/SSH/Perl/AuthMgr.pm line 142

 at /usr/local/lib/perl5/site_perl/5.8.7/Net/SSH/Perl/Packet.pm line 52
Net::SSH::Perl::Packet::read('Net::SSH::Perl::Packet',  
'Net::SSH::Perl::SSH2=HASH(0xa127b4)') called at  
/usr/local/lib/perl5/site_perl/5.8.7/Net/SSH/Perl/AuthMgr.pm line 142
 
Net::SSH::Perl::AuthMgr::run('Net::SSH::Perl::AuthMgr=HASH(0xab1938)',  
'SCALAR(0xab12b4)') called at  
/usr/local/lib/perl5/site_perl/5.8.7/Net/SSH/Perl/AuthMgr.pm line 90
 
Net::SSH::Perl::AuthMgr::authenticate('Net::SSH::Perl:: 
AuthMgr=HASH(0xab1938)') called at  
/usr/local/lib/perl5/site_perl/5.8.7/Net/SSH/Perl/SSH2.pm line 92
 
Net::SSH::Perl::SSH2::_login('Net::SSH::Perl::SSH2=HASH(0xa127b4)')  
called at /usr/local/lib/perl5/site_perl/5.8.7/Net/SSH/Perl/SSH2.pm  
line 66
 
Net::SSH::Perl::SSH2::login('Net::SSH::Perl::SSH2=HASH(0xa127b4)',  
'user', 'pass') called at /Users/boysie/mod_perl_inc/Habitat/CLI/SSH.pm  
line 25
Habitat::CLI::SSH::new('Habitat::CLI::SSH', 'static') called at  
/Users/boysie/mod_perl_inc/Habitat/CLI/Admin.pm line 150
 
Habitat::CLI::Admin::update_vhosts('Habitat::CLI:: 
Admin=HASH(0x801b34)') called at  
/Users/boysie/mod_perl_inc/Habitat/CLI/DIR.pm line 75
Habitat::CLI::DIR::__ANON__ called at  
/Users/boysie/mod_perl_inc/Habitat/CLI.pm line 77
Habitat::CLI::choices('Habitat::CLI::Admin=HASH(0x801b34)',  
'order', 'ARRAY(0xa1237c)', 'title', 'Choose a Main Option:',  
'choices', 'HASH(0xa12310)') called at  
/Users/boysie/mod_perl_inc/Habitat/CLI/DIR.pm line 105
 
Habitat::CLI::DIR::main_choices('Habitat::CLI::Admin=HASH(0x801b34)')  
called at /Users/boysie/mod_perl_inc/Habitat/CLI/DIR.pm line 57
Habitat::CLI::DIR::main('Habitat::CLI::Admin=HASH(0x801b34)')  
called at /Users/boysie/mod_perl_inc/Habitat/CLI.pm line 22
Habitat::CLI::new('Habitat::CLI::Admin') called at  
/Users/boysie/cli/h.pl line 13

Habitat::CLI::SSH::Users DetroyedHabitat::CLI::Admin Class Destroyed

I changed the user/pass above to obsificate the real info...

Like I said this works on one server, and used to work on this server.   
Does this give enough info to tell me what's wrong?


Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com



Re: Need help troubleshooting error using Net::SSH::Perl

2005-11-17 Thread Boysenberry Payne
Disregard this thread, I figured out what it was.  SOmehow the ssh  
server got shut off.


Sorry for the unnecessary noise.

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Nov 17, 2005, at 5:47 PM, Boysenberry Payne wrote:


Hello,

I'm on OS X 10.3.9 / AP2 / MP 2 / Perl 5.8.7
I've got a script that connects to a couple of ssh servers using  
Net::SSH::Perl.


I've been able to log onto both servers using SSH in a terminal and  
previously
my script worked for connecting to both servers.  Now, one server  
gives the following errors:


Trying empty user-authentication request.
Uncaught exception from user code:
Connection closed by remote host. at  
/usr/local/lib/perl5/site_perl/5.8.7/Net/SSH/Perl/AuthMgr.pm line 142

 at /usr/local/lib/perl5/site_perl/5.8.7/Net/SSH/Perl/Packet.pm line 52
Net::SSH::Perl::Packet::read('Net::SSH::Perl::Packet',  
'Net::SSH::Perl::SSH2=HASH(0xa127b4)') called at  
/usr/local/lib/perl5/site_perl/5.8.7/Net/SSH/Perl/AuthMgr.pm line 142
 
Net::SSH::Perl::AuthMgr::run('Net::SSH::Perl::AuthMgr=HASH(0xab1938)',  
'SCALAR(0xab12b4)') called at  
/usr/local/lib/perl5/site_perl/5.8.7/Net/SSH/Perl/AuthMgr.pm line 90
 
Net::SSH::Perl::AuthMgr::authenticate('Net::SSH::Perl:: 
AuthMgr=HASH(0xab1938)') called at  
/usr/local/lib/perl5/site_perl/5.8.7/Net/SSH/Perl/SSH2.pm line 92
 
Net::SSH::Perl::SSH2::_login('Net::SSH::Perl::SSH2=HASH(0xa127b4)')  
called at /usr/local/lib/perl5/site_perl/5.8.7/Net/SSH/Perl/SSH2.pm  
line 66
 
Net::SSH::Perl::SSH2::login('Net::SSH::Perl::SSH2=HASH(0xa127b4)',  
'user', 'pass') called at  
/Users/boysie/mod_perl_inc/Habitat/CLI/SSH.pm line 25
Habitat::CLI::SSH::new('Habitat::CLI::SSH', 'static') called  
at /Users/boysie/mod_perl_inc/Habitat/CLI/Admin.pm line 150
 
Habitat::CLI::Admin::update_vhosts('Habitat::CLI:: 
Admin=HASH(0x801b34)') called at  
/Users/boysie/mod_perl_inc/Habitat/CLI/DIR.pm line 75
Habitat::CLI::DIR::__ANON__ called at  
/Users/boysie/mod_perl_inc/Habitat/CLI.pm line 77
Habitat::CLI::choices('Habitat::CLI::Admin=HASH(0x801b34)',  
'order', 'ARRAY(0xa1237c)', 'title', 'Choose a Main Option:',  
'choices', 'HASH(0xa12310)') called at  
/Users/boysie/mod_perl_inc/Habitat/CLI/DIR.pm line 105
 
Habitat::CLI::DIR::main_choices('Habitat::CLI::Admin=HASH(0x801b34)')  
called at /Users/boysie/mod_perl_inc/Habitat/CLI/DIR.pm line 57
Habitat::CLI::DIR::main('Habitat::CLI::Admin=HASH(0x801b34)')  
called at /Users/boysie/mod_perl_inc/Habitat/CLI.pm line 22
Habitat::CLI::new('Habitat::CLI::Admin') called at  
/Users/boysie/cli/h.pl line 13

Habitat::CLI::SSH::Users DetroyedHabitat::CLI::Admin Class Destroyed

I changed the user/pass above to obsificate the real info...

Like I said this works on one server, and used to work on this server.  
 Does this give enough info to tell me what's wrong?


Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com







Help getting a file handle for uploaded files using CGI

2005-11-11 Thread Boysenberry Payne
I'm getting an undefined value from the code below:

$CGI::DISABLE_UPLOADS = 0;
$CGI::POST_MAX = 100 * 1_048_576;  # 100 MB

my $cgi = new CGI;

print Size: $ENV{CONTENT_LENGTH};

my $cgi_file = $cgi->param( uploaded_file ) || print Error Upload Failed No File Recieved...;
my $fh = $cgi->upload( $cgi_file ) || print Error Upload Failed No File Handle Created For $cgi_file...;

When I upload an image called image.jpg I get the following printed out:

Size: 3012
Error Upload Failed No File Handle Created For images.jpg...

It seems like it sees the file, just can't make a file handle for it.  Anyone know what I'm doing
wrong, or how to find out how to get it to work?

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com


Re: Help getting a file handle for uploaded files using CGI

2005-11-11 Thread Boysenberry Payne
I forgot I'm using Apache2 and MP2.
Is there a way to handle file uploads using apreq2?

Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Nov 11, 2005, at 2:36 PM, Boysenberry Payne wrote:

I'm getting an undefined value from the code below:

$CGI::DISABLE_UPLOADS = 0;
$CGI::POST_MAX = 100 * 1_048_576;  # 100 MB

my $cgi = new CGI;

print Size: $ENV{CONTENT_LENGTH};

my $cgi_file = $cgi->param( uploaded_file ) || print Error Upload Failed No File Recieved...;
my $fh = $cgi->upload( $cgi_file ) || print Error Upload Failed No File Handle Created For $cgi_file...;

When I upload an image called image.jpg I get the following printed out:

Size: 3012
Error Upload Failed No File Handle Created For images.jpg...

It seems like it sees the file, just can't make a file handle for it.  Anyone know what I'm doing
wrong, or how to find out how to get it to work?

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com


Re: Help getting a file handle for uploaded files using CGI

2005-11-11 Thread Boysenberry Payne
Never mind I guess Apache2::Upload is what I'm looking for...
Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Nov 11, 2005, at 2:47 PM, Boysenberry Payne wrote:

I forgot I'm using Apache2 and MP2.
Is there a way to handle file uploads using apreq2?

Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Nov 11, 2005, at 2:36 PM, Boysenberry Payne wrote:

I'm getting an undefined value from the code below:

$CGI::DISABLE_UPLOADS = 0;
$CGI::POST_MAX = 100 * 1_048_576;  # 100 MB

my $cgi = new CGI;

print Size: $ENV{CONTENT_LENGTH};

my $cgi_file = $cgi->param( uploaded_file ) || print Error Upload Failed No File Recieved...;
my $fh = $cgi->upload( $cgi_file ) || print Error Upload Failed No File Handle Created For $cgi_file...;

When I upload an image called image.jpg I get the following printed out:

Size: 3012
Error Upload Failed No File Handle Created For images.jpg...

It seems like it sees the file, just can't make a file handle for it.  Anyone know what I'm doing
wrong, or how to find out how to get it to work?

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com


Re: How to use Apache2::Upload

2005-11-11 Thread Boysenberry Payne
What is $pool in:

APR::Request::Custom->handle($pool, 
$query_string,
$cookie_header,
$parser,
$read_limit,
$brigade)

and how do I get each of the values for this?

Should I use:

APR::Request->handle( ... );

or the above?

Right now I'm doing the following:

sub handle {

$r = shift;

# uploads	
$req = Apache2::Request->new( $r );
$upload = $req->upload( upload_field_name );

# cookies
$jar = Apache2::Cookie::Jar->new( $r );
$cookies = $self->{jar}->cookies();
$table = Apache2::Cookie->fetch( $r );
}

is there a better way, that I'm not getting?

Thank you,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Nov 11, 2005, at 5:48 PM, Philip M. Gollucci wrote:

Boysenberry Payne wrote:
Also, are there equivalents to:
$CGI::DISABLE_UPLOADS
and
$CGI::POST_MAX
???
http://httpd.apache.org/apreq/docs/libapreq2/group__apreq__xs__apr__request.html

Look for
$req->disable_uploads()

and

$req->read_limit($set)

Respectively.

HTH



-- 
--
Love is not the one you can picture yourself marrying,
but the one you can't picture the rest of your life without.

It takes a minute to have a crush on someone, an hour to like someone,
and a day to love someone, but it takes a lifetime to forget someone...

Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com




Re: 1. ActivePerl vs mod_perl: different results (how to clear the variables before restarts?)

2005-11-08 Thread Boysenberry Payne

my $counter;
print Content-type: text/html\n\n;
print $char.=*,br\n.++$counter

using my to declare your variable should resolve your scoping issue

Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Nov 8, 2005, at 9:52 PM, Plymouth Rock wrote:

  There is the problem: first running time my script gives correct 
results
on mod_perl2.0.2 (Win32, Apache2.0.54, IE6), but after any next 
restart (F5

in browser) the variables do not clear:

print Content-type: text/html\n\n;
print $char.=*,br\n.++$counter

unless I restart my Apache webserver. There isn't any problem when the
script is running or restarting on ActivePerl5.8.7.
 How to solve the problem for mod_perl without clearing the variables
manually at the end of the script ($char.=; $counter=0) or 
restarting the

webserver before every script's restarting?

 Thanx.







Questions about memory

2005-11-05 Thread Boysenberry Payne
Now that I'm at the tail end of my current project (not necessarily the 
best time to tackle

this issue I know) I'm looking at my httpd processes using top:

  PID COMMAND  %CPU   TIME   #TH #PRTS #MREGS RPRVT  RSHRD  RSIZE  
VSIZE
16970 httpd0.0%  0:00.01   1 9   247   108K  17.5M  1.32M  
60.1M
16961 httpd0.0%  0:00.00   1 9   247   108K  17.5M  1.30M  
60.1M
16960 httpd0.0%  0:00.01   1 9   247   108K  17.5M  1.30M  
60.1M
16959 httpd0.0%  0:00.69   1 9   256  1.64M  17.4M  6.24M  
61.1M
16958 httpd0.0%  0:01.07   1 9   278  2.33M  17.4M  7.64M  
61.1M
16957 httpd0.0%  0:01.23   1 9   291  3.96M  17.7M  13.0M  
63.5M
13220 httpd0.0%  0:28.69   1 9   24732K  17.5M  11.6M  
60.1M


It gives a selection of used and non-used children (as well as root 
13220.)


Are they memory intensive?  I know it depends on the CPU, RAM, etc...
But what is big nowa days?  Am I looking at this with the wrong tool?

Basically I'm looking for pointers on how to tighten things up.  I'm 
hoping
to use this in a production environment and need to know when I need to 
scale

things up.

I'm a novice when it comes to memory management, sorry.  So as much
as as anyone can provide is much appreciated.

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com



Re: Error while using Apache2::Reload

2005-11-01 Thread Boysenberry Payne

Well I've tried to reinstall perl, apache2 and mod_perl.
I have the @lib trimmed down too.  Still get the same error.
Anything else I can do?

Here is the error again:

Can't locate mod_perl.pm in @INC (@INC contains: 
/Users/boysie/mod_perl_inc /usr/local/lib/perl5/5.8.7/darwin-2level 
/usr/local/lib/perl5/5.8.7 /usr/local/lib/perl5 
/usr/local/lib/perl5/site_perl/5.8.7/darwin-2level 
/usr/local/lib/perl5/site_perl/5.8.7 /usr/local/lib/perl5/site_perl .) 
at /usr/local/lib/perl5/site_perl/5.8.7/darwin-2level/Apache2/Reload.pm 
line 160.


Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Oct 31, 2005, at 4:45 PM, Tyler MacDonald wrote:


Boysenberry Payne [EMAIL PROTECTED] wrote:

I would like to do the make uninstall approach below first before
going
through reinstalling perl and MP2.
Before I do this I want to make sure I have the right syntax first.
would I just type 'make uninstall' in the source directory for MP2 
RC5?

Or do I need to put together a script that will run
'ExtUtils::Install::uninstall(/path/to/.packlist)'
Where /path/to.packlist is what?


From what I gather, if you've never done a make clean in your
original source directory, make uninstall should do it. If not, on my
system, the .packlist files get stuck in 
/usr/local/lib/perl/5.8.7/auto/...

and it looks like you can just do something like;

	cat /usr/local/lib/perl/5.8.7/auto/Devel/Cover/.packlist | xargs rm 
-vf


But I'd try make uninstall first.

- Tyler







Re: Error while using Apache2::Reload

2005-11-01 Thread Boysenberry Payne
How do I apply the patch?  I'm still a little wet behind the ears, 
please excuse me...


Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Nov 1, 2005, at 10:20 AM, Geoffrey Young wrote:


I think this is the same problem that just came up in a different
circumstance - $INC{'mod_perl.pm'} being a virtual file in mp2.

try this patch

--Geoff
Index: lib/Apache2/Reload.pm
===
--- lib/Apache2/Reload.pm   (revision 328346)
+++ lib/Apache2/Reload.pm   (working copy)
@@ -135,6 +135,7 @@
 my $file = $Apache2::Reload::INCS{$key};

 next unless defined $file;
+next unless -f $file;   # don't try to reload /dev/null
 next if @watch_dirs  !grep { $file =~ /^$_/ } @watch_dirs;
 warn Apache2::Reload: Checking mtime of $key\n if $DEBUG;





DBD::mysql threads sleeping

2005-11-01 Thread Boysenberry Payne
I noticed that even after I use my database handle with the disconnect 
function
(i.e. $dbh-disconnect()) the mysql thread that was used for the 
database connection

hangs around in the sleep state, and reused later.

When I use a non-mod_perl perl script using DBI the mysql thread goes 
away.

Is this a feature of Apache::DBI?

I'm using OS X 10.3.9 Apache2 MP2 Perl5.8.7 and the most recent versions
of DBI, Apache::DBI and DBD::mysql


Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com



Re: Error while using Apache2::Reload

2005-10-31 Thread Boysenberry Payne

Should I just edit out the line in Apache2::Reload that checks for MP2?

Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Oct 29, 2005, at 5:01 AM, Boysenberry Payne wrote:

I still haven't been able to get Apache2::Reload working after my MP  
2.0.0 RC5
upgrade.  I even tried to reinstall to no avail.  Does anyone know how  
to get this working?

Did I miss something in Philip M. Gollucci's post?

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Oct 18, 2005, at 12:37 PM, Boysenberry Payne wrote:

Did you specificy mod_perl.pm as file to reload in the config by  
accident?


No, it started happening just after the MP 2.0.0 RC5 upgrade...

This is what I got as a return from:
find /Users/boysie/mod_perl_inc /opt/local/lib/perl5 -name Reload.pm  
| xargs grep -n mod_perl


20:use mod_perl2;
391:path. Now remember that mod_perl freezes the value of C@INC at  
the

505:are used, not every interpreters at once.  Similar to mod_perl 1.0
537:mod_perl 2.0 and its core modules are copyrighted under
545:Stas Bekman (porting to mod_perl 2.0)
548:and CApache::StatINC (mod_perl 1.x) by Doug MacEachern and Ask



Thanks,

Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com


On Oct 18, 2005, at 12:49 AM, Philip M. Gollucci wrote:


Boysenberry Payne wrote:

I'm getting the following error while trying to use Apache2::Reload
on Apache/2.0.55 (Unix) PHP/5.0.5 DAV/2  
mod_apreq2-20050712/2.5.2-dev mod_perl/2.0.2-dev Perl/v5.8.7
Can't locate mod_perl.pm in @INC (@INC contains:  
/Users/boysie/mod_perl_inc /opt/local/lib/perl5/5.8.7/darwin-2level  
/opt/local/lib/perl5/5.8.7  
/opt/local/lib/perl5/site_perl/5.8.7/darwin-2level  
/opt/local/lib/perl5/site_perl/5.8.7 /opt/local/lib/perl5/site_perl  
/opt/local/lib/perl5/vendor_perl/5.8.7/darwin-2level  
/opt/local/lib/perl5/vendor_perl/5.8.7  
/opt/local/lib/perl5/vendor_perl /usr/local/apache2) at  
/opt/local/lib/perl5/site_perl/5.8.7/darwin-2level/Apache2/ 
Reload.pm line 160.\n
The only thing I can think of is that you have an Apache2::Reload in  
your inc path from a pre 2.0.0 RC5 release that is being found  
before the one from Apache2::Reload from 2.0.2-dev. Did you  
specificy mod_perl.pm as file to reload in the config by accident?


find /Users/boysie/mod_perl_inc /opt/local/lib/perl5 -name Reload.pm  
| xargs \ 	

grep -n mod_perl

Here's the loop from Reload.pm

Anyone think the
$INC{mod_perl.pm} = File::Spec::Functions::devnull();
change in mod_perl2.pm could be causing this I don't have time  
to test it at the moment.


foreach my $key (sort { $a cmp $b } keys %Apache2::Reload::INCS) {
my $file = $Apache2::Reload::INCS{$key};

next unless defined $file;
next if @watch_dirs  !grep { $file =~ /^$_/ } @watch_dirs;
warn Apache2::Reload: Checking mtime of $key\n if $DEBUG;

my $mtime = (stat $file)[9];

unless (defined($mtime)  $mtime) {
for (@INC) {
$mtime = (stat $_/$file)[9];
last if defined($mtime)  $mtime;
}
}

warn(Apache2::Reload: Can't locate $file\n), next
unless defined $mtime and $mtime;

unless (defined $Stat{$file}) {
$Stat{$file} = $^T;
}

if ($mtime  $Stat{$file}) {
my $package = module_to_package($key);
ModPerl::Util::unload_package($package);
require $key;
warn(Apache2::Reload: process $$ reloading $package  
from $key\n)

if $DEBUG;
}
$Stat{$file} = $mtime;
}


--
END

What doesn't kill us can only make us stronger.
Nothing is impossible.

Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
  http://www.liquidityservicesinc.com
   http://www.liquidation.com
   http://www.uksurplus.com
   http://www.govliquidation.com
   http://www.gowholesale.com














Re: Error while using Apache2::Reload

2005-10-31 Thread Boysenberry Payne
Actually someone sent me an off list message saying they had the same 
problem after installing

the latest MP upgrade.
If it is some old junk left in the @INC how would I go about 
correcting it?
If I'm not mistaken Apache2::Reload is a part of the MP2 install, so I 
can't

just reinstall Apache2::Reload.

Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Oct 31, 2005, at 2:56 PM, Perrin Harkins wrote:


On Mon, 2005-10-31 at 14:44 -0600, Boysenberry Payne wrote:
Should I just edit out the line in Apache2::Reload that checks for 
MP2?


The fact that you're having this problem and no one else is reporting 
it

probably means that something is wrong with your system, not with
Apache2::Reload.  If possible, try it on another system.  It seems
likely that you are either running a different version of Reload than
you think you are, or else have some old junk left in your @INC from a
previous installation of mod_perl.

In short, editing that line is unlikely to fix the real problem here.

- Perrin







Re: Error while using Apache2::Reload

2005-10-31 Thread Boysenberry Payne

I still have the original source.
But I think the reason this is happening is because I used
Darwin Port (a Darwin package installer) to install my original MP 2.
Then,  when I installed MP2 RC5 from source I started getting the error.
I used the port uninstall the package first, but maybe it didn't work.

I would like to do the make uninstall approach below first before 
going

through reinstalling perl and MP2.
Before I do this I want to make sure I have the right syntax first.
would I just type 'make uninstall' in the source directory for MP2 RC5?
Or do I need to put together a script that will run 
'ExtUtils::Install::uninstall(/path/to/.packlist)'

Where /path/to.packlist is what?

Thanks for all the help,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Oct 31, 2005, at 3:51 PM, Tyler MacDonald wrote:


Perrin Harkins [EMAIL PROTECTED] wrote:

If it is some old junk left in the @INC how would I go about
correcting it?


My approach would be to start with a new Perl install and a new
mod_perl.  There is no official way to uninstall a Perl module, so 
it's
hard to be sure that you got everything related to the previous 
Apache2

build.


make uninstall / ExtUtils::Install::uninstall(/path/to/.packlist)
aren't official? I suppose you'd have to have the old pacakage's 
source tree

still laying around...

- Tyler







Re: Error while using Apache2::Reload

2005-10-29 Thread Boysenberry Payne
I still haven't been able to get Apache2::Reload working after my MP 
2.0.0 RC5
upgrade.  I even tried to reinstall to no avail.  Does anyone know how 
to get this working?

Did I miss something in Philip M. Gollucci's post?

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Oct 18, 2005, at 12:37 PM, Boysenberry Payne wrote:

Did you specificy mod_perl.pm as file to reload in the config by 
accident?


No, it started happening just after the MP 2.0.0 RC5 upgrade...

This is what I got as a return from:
find /Users/boysie/mod_perl_inc /opt/local/lib/perl5 -name Reload.pm | 
xargs grep -n mod_perl


20:use mod_perl2;
391:path. Now remember that mod_perl freezes the value of C@INC at 
the

505:are used, not every interpreters at once.  Similar to mod_perl 1.0
537:mod_perl 2.0 and its core modules are copyrighted under
545:Stas Bekman (porting to mod_perl 2.0)
548:and CApache::StatINC (mod_perl 1.x) by Doug MacEachern and Ask



Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Oct 18, 2005, at 12:49 AM, Philip M. Gollucci wrote:


Boysenberry Payne wrote:

I'm getting the following error while trying to use Apache2::Reload
on Apache/2.0.55 (Unix) PHP/5.0.5 DAV/2 
mod_apreq2-20050712/2.5.2-dev mod_perl/2.0.2-dev Perl/v5.8.7
Can't locate mod_perl.pm in @INC (@INC contains: 
/Users/boysie/mod_perl_inc /opt/local/lib/perl5/5.8.7/darwin-2level 
/opt/local/lib/perl5/5.8.7 
/opt/local/lib/perl5/site_perl/5.8.7/darwin-2level 
/opt/local/lib/perl5/site_perl/5.8.7 /opt/local/lib/perl5/site_perl 
/opt/local/lib/perl5/vendor_perl/5.8.7/darwin-2level 
/opt/local/lib/perl5/vendor_perl/5.8.7 
/opt/local/lib/perl5/vendor_perl /usr/local/apache2) at 
/opt/local/lib/perl5/site_perl/5.8.7/darwin-2level/Apache2/Reload.pm 
line 160.\n
The only thing I can think of is that you have an Apache2::Reload in 
your inc path from a pre 2.0.0 RC5 release that is being found before 
the one from Apache2::Reload from 2.0.2-dev. Did you specificy 
mod_perl.pm as file to reload in the config by accident?


find /Users/boysie/mod_perl_inc /opt/local/lib/perl5 -name Reload.pm 
| xargs \ 	

grep -n mod_perl

Here's the loop from Reload.pm

Anyone think the
$INC{mod_perl.pm} = File::Spec::Functions::devnull();
change in mod_perl2.pm could be causing this I don't have time to 
test it at the moment.


foreach my $key (sort { $a cmp $b } keys %Apache2::Reload::INCS) {
my $file = $Apache2::Reload::INCS{$key};

next unless defined $file;
next if @watch_dirs  !grep { $file =~ /^$_/ } @watch_dirs;
warn Apache2::Reload: Checking mtime of $key\n if $DEBUG;

my $mtime = (stat $file)[9];

unless (defined($mtime)  $mtime) {
for (@INC) {
$mtime = (stat $_/$file)[9];
last if defined($mtime)  $mtime;
}
}

warn(Apache2::Reload: Can't locate $file\n), next
unless defined $mtime and $mtime;

unless (defined $Stat{$file}) {
$Stat{$file} = $^T;
}

if ($mtime  $Stat{$file}) {
my $package = module_to_package($key);
ModPerl::Util::unload_package($package);
require $key;
warn(Apache2::Reload: process $$ reloading $package from 
$key\n)

if $DEBUG;
}
$Stat{$file} = $mtime;
}


--
END

What doesn't kill us can only make us stronger.
Nothing is impossible.

Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
  http://www.liquidityservicesinc.com
   http://www.liquidation.com
   http://www.uksurplus.com
   http://www.govliquidation.com
   http://www.gowholesale.com










Re: Error while using Apache2::Reload

2005-10-18 Thread Boysenberry Payne
Did you specificy mod_perl.pm as file to reload in the config by 
accident?


No, it started happening just after the MP 2.0.0 RC5 upgrade...

This is what I got as a return from:
find /Users/boysie/mod_perl_inc /opt/local/lib/perl5 -name Reload.pm | 
xargs grep -n mod_perl


20:use mod_perl2;
391:path. Now remember that mod_perl freezes the value of C@INC at the
505:are used, not every interpreters at once.  Similar to mod_perl 1.0
537:mod_perl 2.0 and its core modules are copyrighted under
545:Stas Bekman (porting to mod_perl 2.0)
548:and CApache::StatINC (mod_perl 1.x) by Doug MacEachern and Ask



Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Oct 18, 2005, at 12:49 AM, Philip M. Gollucci wrote:


Boysenberry Payne wrote:

I'm getting the following error while trying to use Apache2::Reload
on Apache/2.0.55 (Unix) PHP/5.0.5 DAV/2 mod_apreq2-20050712/2.5.2-dev 
mod_perl/2.0.2-dev Perl/v5.8.7
Can't locate mod_perl.pm in @INC (@INC contains: 
/Users/boysie/mod_perl_inc /opt/local/lib/perl5/5.8.7/darwin-2level 
/opt/local/lib/perl5/5.8.7 
/opt/local/lib/perl5/site_perl/5.8.7/darwin-2level 
/opt/local/lib/perl5/site_perl/5.8.7 /opt/local/lib/perl5/site_perl 
/opt/local/lib/perl5/vendor_perl/5.8.7/darwin-2level 
/opt/local/lib/perl5/vendor_perl/5.8.7 
/opt/local/lib/perl5/vendor_perl /usr/local/apache2) at 
/opt/local/lib/perl5/site_perl/5.8.7/darwin-2level/Apache2/Reload.pm 
line 160.\n
The only thing I can think of is that you have an Apache2::Reload in 
your inc path from a pre 2.0.0 RC5 release that is being found before 
the one from Apache2::Reload from 2.0.2-dev. Did you specificy 
mod_perl.pm as file to reload in the config by accident?


find /Users/boysie/mod_perl_inc /opt/local/lib/perl5 -name Reload.pm | 
xargs \ 	

grep -n mod_perl

Here's the loop from Reload.pm

Anyone think the
$INC{mod_perl.pm} = File::Spec::Functions::devnull();
change in mod_perl2.pm could be causing this I don't have time to 
test it at the moment.


foreach my $key (sort { $a cmp $b } keys %Apache2::Reload::INCS) {
my $file = $Apache2::Reload::INCS{$key};

next unless defined $file;
next if @watch_dirs  !grep { $file =~ /^$_/ } @watch_dirs;
warn Apache2::Reload: Checking mtime of $key\n if $DEBUG;

my $mtime = (stat $file)[9];

unless (defined($mtime)  $mtime) {
for (@INC) {
$mtime = (stat $_/$file)[9];
last if defined($mtime)  $mtime;
}
}

warn(Apache2::Reload: Can't locate $file\n), next
unless defined $mtime and $mtime;

unless (defined $Stat{$file}) {
$Stat{$file} = $^T;
}

if ($mtime  $Stat{$file}) {
my $package = module_to_package($key);
ModPerl::Util::unload_package($package);
require $key;
warn(Apache2::Reload: process $$ reloading $package from 
$key\n)

if $DEBUG;
}
$Stat{$file} = $mtime;
}


--
END

What doesn't kill us can only make us stronger.
Nothing is impossible.

Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
  http://www.liquidityservicesinc.com
   http://www.liquidation.com
   http://www.uksurplus.com
   http://www.govliquidation.com
   http://www.gowholesale.com






  1   2   >