Apache::DBI Question

2005-10-16 Thread Jonathan

my webapp is using mysql + apache::dbi to store data

on starting up my webapp, i need to pull some data from mysql that is  
in the parent process (pre fork)


pre fork connections are bad though, so i'm wondering:

a_ do i have 2 db connect strings:
1. prefork dbh - instantiated prefork , then disconnect
2. postfork dbh - instantiated postfork

b_ do i have 1 db connection string
1. standard dbh - instantiate prefork, then disconnect
2. standard dbh - instantiate postfork

c_ something else

any help will be appreciated


Re: Apache::DBI Question

2005-10-17 Thread Jonathan


perrin: great - i couldn't find any documentation on this! thanks a ton.

all: can i wishlist some more documentation on the forking process

maybe something like the compression faq, where we go into detail  
about exactly when where why you do things before/after the fork,  
show some more examples, etc.  the current documentation on this is  
sparse.


i'd be happy to start on an outline and contribute, but i'm still  
wary on this issue and don't have much to contribute just yet.  its a  
topic that i see coming up often - both in my own work, and looking  
at other's questions posted on the list.


On Oct 16, 2005, at 11:38 PM, Perrin Harkins wrote:


Jonathan wrote:

on starting up my webapp, i need to pull some data from mysql that  
is  in the parent process (pre fork)

pre fork connections are bad though, so i'm wondering:
a_ do i have 2 db connect strings:
1. prefork dbh - instantiated prefork , then disconnect
2. postfork dbh - instantiated postfork
b_ do i have 1 db connection string
1. standard dbh - instantiate prefork, then disconnect
2. standard dbh - instantiate postfork
c_ something else


Re: Apache::DBI Question

2005-10-17 Thread Jonathan


a) perrin, thanks again.
I checked the DBI pod and source, and couldn't elucidate the info  
that i needed.  some of the source is above my skillset still.


b)

Here is some:
http://modperlbook.org/html/ch01_02.html
saw that in the print version.  there's a bit in the devel cookbook  
too, but not much in the official docs.


c)

I'd be happy to offer suggestions and fixes if you start it up.
- Perrin


I'm going to start an outline tonight on what I think should be  
covered, and take a stab at the answers.
I'll put it on publically writable wiki, and post the url here.   
hopefully some people can set me straight, add what they think should  
be in there, and then add the document to the mod_perl docs.


Off Topic - Apache::Session::MySQL and invalid Session IDs

2005-10-17 Thread Jonathan

I'm hoping someone here has a suggestion-

I wrote my mod_perl app with Session::File (local development) and am
migrating it to Session::MySQL so it could cluster

I ran into this issue:

 If I try to tie with a session id that doesn't exist in the db,
the app catches an Apache::Session die

Ideally:

 If I try to tie with a session id that doesn't exist in the db,
the app rewrites the session id to null (which generates a new
session id)

to handle this under Session::File, I had a function validate the
session id given from cookie/url/getpost
 a_ is it 32 char (since ids are md5_hex generated) ?
 b_ does the file exist in the session file dir ?

then the app tied to an existing session , or , a new one

I can't figure out how to do this with Session::MySQL cleanly - the
only idea that I've come up with is pre-caching the db handle and
doing a SQL select to see if the record exists  -- but then I end up
making 2 sql queries for the session data when 1 is really all that
should be necessary.

clearly i'm missing something obvious - can someone set me straight?

(apologies if this is posted 2x, i accidentally submitted from an  
unsubscribed address)


Off Topic - Apache::Session::MySQL and invalid Session IDs

2005-10-17 Thread Jonathan

I'm hoping someone here has a suggestion-

I wrote my mod_perl app with Session::File (local development) and am  
migrating it to Session::MySQL so it could cluster


I ran into this issue:

If I try to tie with a session id that doesn't exist in the db,  
the app catches an Apache::Session die


Ideally:

If I try to tie with a session id that doesn't exist in the db,  
the app rewrites the session id to null (which generates a new  
session id)


to handle this under Session::File, I had a function validate the  
session id given from cookie/url/getpost

a_ is it 32 char (since ids are md5_hex generated) ?
b_ does the file exist in the session file dir ?

then the app tied to an existing session , or , a new one

I can't figure out how to do this with Session::MySQL cleanly - the  
only idea that I've come up with is pre-caching the db handle and  
doing a SQL select to see if the record exists  -- but then I end up  
making 2 sql queries for the session data when 1 is really all that  
should be necessary.


clearly i'm missing something obvious - can someone set me straight?


POST vs GET

2005-10-31 Thread Jonathan

Background Running: current stable of mp2 and libapreq-devel

Problem:
I'm allowing GET style urls to forms for pre-population
If the POST action is dirty though, i get cross contamination of  
vars IF there was a NULL action in the form


ie:
url:
  [EMAIL PROTECTED]&subject=hello
becomes form:
  {form action="" method=POST"}
  email: [ [EMAIL PROTECTED]
  subject: [ hello ]
  body: []
 {/form}

if i submit that, then it submits the POST data (as it should)  
to the url [EMAIL PROTECTED]&subject=hello


   when i access that info with ->param('fieldname'), the url data  
in the get string takes precedence and ignores the POST


obviously, the correct recourse is to go through all of my templates,  
make sure that there is a valid and specified page that the action is  
posting to, and yell at those who left those fields blank in  
templates they gave to me.


but, can i hope (can i? seriously.) that there is some mechanism in  
mp2/libapreq that will let me explcitly choose whether param is  
pulling POST or GET data for a given fieldname - so i can put a  
temporary solution in place?  because I really not in a template- 
fixing mood right now , and i'd rather just use some code until later.




Re: POST vs GET

2005-10-31 Thread Jonathan


On Oct 31, 2005, at 6:29 PM, Joe Schaefer wrote:


pulling POST or GET data for a given fieldname

In place of param(), use the body() or args() methods, respectively.


Simple and stupid enough.  Many thanks!



Re: POST vs GET

2005-10-31 Thread Jonathan
typo. i'm not in good typing mode today -  i strained something in my  
neck, and have having trouble motivating myself  to work, much less  
perform correctly.


thanks for the note.

On Oct 31, 2005, at 6:18 PM, Philip M. Gollucci wrote:


I assume this is a typo, but that should be method="POST"
just to state the obvious. ^


Re: Questions about memory

2005-11-05 Thread Jonathan


get a copy of the mod perl book on oreilly

this chapter is invaluable:
http://www.modperlbook.org/html/part2.html

read through it online or in the book.  it'll answer most of  your  
questions.


On Nov 5, 2005, at 3:06 PM, Boysenberry Payne wrote:

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: Apache, mod_perl and PHP

2005-11-07 Thread Jonathan


i can't talk as to why that's happening - aside from stating the  
obvious that the server is forgetting to parse things as php.


what i will say is this:

redo your system as a multi-server setup.

run a seperate configuration of mod_perl bound to port 8080 or  
something on localhost, and proxypass to it.
run mod_ssl on the front and let that handle the decryption, static  
files, and toss php on it if needed (or run php on something else)


that  should not only get rid of compatibility issues, but save you a  
lot of overhead... the only reason you should be running php and  
mod_perl on the same server instance is if they need to talk to each  
other.  you're wasting a bunch of memory and overhead otherwise.




On Nov 7, 2005, at 8:57 AM, Malka Cymbalista wrote:


We are having a strange problem with our PHP sites and I was wondering
of someone has any pointers to offer.
We are running apache 2.0.55 with mod_perl 2.0.1 and php 4.3.3 and
mod_ssl 2.0.55 on  a Sun Solaris machine.  Every now and then, when
you
click on a URL that is a php script, instead of the file executing, a
File Download panel opens and it asks if you want to  save it to your
computer.  It is as if it does not recognize that it is a php file.
Sometimes it actually displays the code of the file. The really
strange
thing is that it appears to happen randomly.  That is, some times the
same link  works perfectly well and the links open properky.  But
sometimes, it asks if you want to save the file. If you click on
Cancel
and then click on the link again, it usually opens properly.
Someone told me that there are problems for mod perl and php and
mod_ssl to live together.  Most of our site is in perl so I am not
about
to give up the mod_perl abilities but there are a few people who
insist
on PHP and I'd like that to be able to work properly as well. Does
anyone have any information on this and is there anything I can do so
that everything works?

Thanks for any help.



Malka Cymbalista
Webmaster, Weizmann Institute of Science
[EMAIL PROTECTED]
08-934-3036





Re: Apache::Session's session size

2005-11-30 Thread Jonathan


On Nov 30, 2005, at 12:30 AM, Perrin Harkins wrote:

It certainly can be a scoping issue, but it could also be a locking
issue.  Without seeing a test case that causes it, it's pretty hard to
guess.


I'd suggest running data dumper and storing each iteration of a  
'session' variable to a different text file -- then looking at them  
and seeing how/why they're growing large.


At my last fulltime job, i had to fix a .NET project another agency  
made.  the devry graduate who programmed it saved a serialized  
(encrypted) version of the session user as a hidden formfield to get  
past browser cookies and an inability to munge server URIs.  aside  
from the user account info being obscenely big (40k ?! on first load)  
-- he also had it save recursively.


ie:
session{user}
session{user{user}}
session{user{user}{user}}

so after 4 pageloads, you had a 200k html page because of that  
serialized session.  Not good , nor necessary.


Once, on something I quickly threw together, I stored the last  
requested URL in the session var.  a typo ended up in me essentially  
appending the URL as a history, not replacing it entirely.  a couple  
hours of testing, and I had a 300k session variable and i couldn't  
figure out why performance was degrading.


Re: Solving mod_perl scalability issues for lots of slow connections

2005-12-21 Thread Jonathan


I fwd'd this to a friend with commit access to twisted.  hopefully  
i'll get a response on clarification.


But from what I understand, the Twisted networking framework works  
like this:
	The twisted 'reactor' is single threaded.  It uses select by  
default, you can use poll.  The docs suggest that one can specify a  
multithreaded reactor, but I'm not quite sure.
	The docs also specify a threadpool, and it seems that the deferred  
callback system has been implemented into it.


CherryPy is a http server framework for python, and that supports a  
single or multi threaded server mode.


On Dec 21, 2005, at 12:23 PM, Perrin Harkins wrote:


On Tue, 2005-12-20 at 14:42 -0800, Ken Simpson wrote:

Alas, if only the Perl interpreter was truly thread safe and did not
clone a new interpreter for each thread, we could just use
threads... Those Python people have it good in some ways.


Not that good really.  As I understand it, the Python interpreter  
has a
global lock when using threads.  That's probably part of the reason  
why

the most popular server framework for Python, Twisted, is single-
threaded.

- Perrin





Re: Apache2::Cookies - getting all names

2005-12-26 Thread Jonathan


This is what I do:

my $cookiejar   = Apache2::Cookie::Jar->new( $this->{'ApacheRequest'} );
my @names   = $cookiejar->cookies();
	DEBUG_COOKIE >0 &&  print STDERR "-| Found These Cookies : " . (join  
" , ",@names) . "\n";
	if ( $cookiejar->cookies( $this->{'CookieDefaults'}->{'names'}-> 
{'Session'} ) )

{
		DEBUG_COOKIE >0 && print STDERR "-|  Handling cookie: {$this-> 
{'CookieDefaults'}->{'names'}->{'Session'}} \n";

DEBUG_COOKIE >0 && print STDERR "-|>> Validating... \n";
my  %c_cookies = Apache2::Cookie->fetch( 
$this->{'ApacheRequest'} );
		my 	$c_value = $c_cookies{ $this->{'CookieDefaults'}->{'names'}-> 
{'Session'} }->value;
		DEBUG_COOKIE >0 && print STDERR "-|   \%c_cookies => \{\} ; \ 
$c_cookies\{{$this->{'CookieDefaults'}->{'names'}->{'Session'}}\}- 
>value = '", $c_value , "'\n";
		DEBUG_COOKIE >0 && print STDERR "-|   Validating c_value  
$c_value \n";

}   



you've got
my @vals = $cookie->value();

as far as i know, cookies only have a single scalar value. you'll  
need to serialize/deserialize any other data structure into it.


cookiedefaults are something that i set in a sitewide configuration  
file:


my $CookieDefaults ={
domain  =>   
[
'127.0.0.1',
'dev.2xlp.com',
],
path=> '/',
expires => '+365d',
secure  => 0,
names   =>
{
'Session' => 'my_session',
'AutoLogin' => 'my_autologin',
}
};


and i have a session wrapper class that sets/reads cookies for all  
domains in the cookie defaults configuration, for the Session cookie  
( named names[Session] ) or AutoLogin cookie ( names[AutoLogin] )


that setup is very manageable for me



On Dec 26, 2005, at 1:32 PM, Jeff wrote:


Folks,

I am finding it hard to correctly interpret the Apache2::Cookie  
documentation: The docs say:

  @names = $j->cookies();# all cookie names

When I do this, for the following cookies:
  c1 => 'v1',
  c2 => 'v2',

I expect @names to contain ( "c1", "c2" ), but instead
@names contains ( "c1", "c1=v1", "c2", "c2=v2" )

The following code has the above problem:

my $jar =  Apache2::Cookie::Jar->new( $r );
my @names   = $jar->cookies;
for my $name ( @names ) {
  my $cookie = $jar->cookies( $name );
  my @vals = $cookie->value();
  print "cookie: $name values: @vals\n";
}


Instead, I have ended up with:

my $jar =  Apache2::Cookie::Jar->new( $r )->cookies;
my @cookies = values %$jar;
for my $cookie ( @cookies ) {
  my $token = $cookie->name();
  my @vals = $cookie->value();
  print "cookie: $token value: @vals\n";
}


Is there a better way? I couldn't get this to work:

my @cookies = values /
  %{ scalar Apache2::Cookie::Jar->new( $r )->cookies };

- seems that the Jar class is trying much to hard to be clever? Or  
maybe I'm just being dumb?


Thoughts appreciated,

Jeff








Re: mailing list does NOT work

2005-12-28 Thread Jonathan


On Dec 28, 2005, at 5:41 PM, JupiterHost.Net wrote:

I see. In that case, since most people don't want to test the  
unsubscribe mechanism for someone assumedly too dumb or lazy to try  
it, they should specify what the problem:


"I've tried emailing [EMAIL PROTECTED] from [EMAIL PROTECTED] and get  
the confirmation that its unsubscribed but am still getting list  
emails at [EMAIL PROTECTED] Is there another way to get unsubscribed  
or can the moderators assist me"


intead of an ignorant sounding SCREAMING pointless rant spam to all  
the subscribers who have no control over their ignorance and can't  
read theri mind that the mechanism has been tried and its failed  
and can only suggest a course of action based on common sense.


Still, I beleive its moot in this case since the same email was  
sent by two "people". IE its a phishing mail and not a real request.


Someone said it didn't work when i posted the unsubscribe  
instructions last week.  I wondered why they didn't post "Hey, the  
unsubscibe feature is broken.  Can someone fix it or unsub me?".  So  
I tested the mechanism, and could unsubscribe / subscribe my  
address.  As far as I can tell, it is not broken.


BUT i don't see how its phishing.  You can scrape all the addresses  
to this list off the web or by just subscribing.





Re: [slightly OT] Catalyst? Maypole?

2006-01-20 Thread Jonathan


Forgot to add:

I'm big on templating...

If you're looking at multiple frameworks, remember to keep templating  
in mind


Making /designing the damn things can take more time than coding your  
logic.  and switching them from one system to another can be a  
nightmare.


Some systems are very interchangeable (like there are TAL  
implementations for most languages) , others are not.   
Template::Toolkit and HTML::Template are supported by most perl  
frameworks , but I think Mason integration is limited.   
Text::Template shouldn't be hard to extend into anything you want.




On Jan 20, 2006, at 12:27 PM, Dan Axtell wrote:

I've been meaning to look at Catalyst, but I'm pretty happy with the
CGI::Builder framework, which is very flexible, is pretty well  
integrated
with other CPAN tools such as session management and templates  
modules, and
more or less follows the Apache request cycle.  It started out as  
an improved

CGI::Application clone but is much better and more flexible.



Re: Patch for Apache::DBI v 0.9901 under MP2 using prefork

2006-01-28 Thread Jonathan


I ran into the same issue.  I found a cheap workaround-

I have a config handle.  Same db, with a readonly user called  
REGULARNAME_config , connects on prefork to pull in server config info.


no matter what i do though, i can't seem to kill the config  
connection.  it just kinda sits there and apache::dbi won't clear  
it.  annoying.


On Jan 28, 2006, at 7:30 PM, Clinton Gormley wrote:


Some of my perl modules connect to the database during startup, and I
have been getting errors when my children try to connect to the
database, because they end up trying to share the $dbh handles from  
the

parent.


Re: hardware prerequisite

2006-02-02 Thread Jonathan


On Feb 2, 2006, at 4:15 AM, Ken Perl wrote:


My machine which cpu is celeron 266Mhz is running Debian 3.1, and
apche2 modperl2 are configured for running the content manager program
WebGUI which needs modperl2.
Now my issue is the performance is very bad and very slow even I click
edit a link.
The question is what is hardware prereuisite for modperl2 and  
apache2 ?


I'd upgrade the machine, as stated before .

i'd also suggest not using debian and using one of the BSDs tailored  
to web serving.  Not to trash debian - i love it - and there's not  
much of a difference on modern machines.  but if you're using  
something like that, i'd opt for something that is stripped down and  
profiled to  web content serving to squeeze every bit of juice out of  
it.


7years ago in college I did a dating site/party on a modperl apache2  
platform.  when 500 people tried using it at once, the machine died -  
and that was the only project running on that box.





Catching a POST_MAX overage

2006-02-02 Thread Jonathan

I've got POST_MAX set to limit to 100k

sub handler
{
my  $r   = shift;
	my 	$apr = Apache2::Request->new( $r , DISABLE_UPLOADS=>0 ,  
POST_MAX=>100_000 );

}

I'm able to upload files < 100 k fine

But I just realized -

what will happen if i try to upload a 200k file?

so i tried to see what would happen

and this happend:

errlog-
[Thu Feb 02 20:11:19 2006] [error] [client fe80::211:24ff:fec1:f053]  
(20014)Error string not specified yet: Content-Length header (241914)  
exceeds configured max_body limit (10), referer: http://g5.local: 
8082/my/photos/


browser-
constant loading symbol

no error got tripped.

i went looking for POST_MAX on google and some books to find out how  
to catch the error.  I can't.

can someone point me in the right direction?


Re: Clarifying Q: Usage suggestions: caching DB metadata with mod_perl?

2006-02-05 Thread Jonathan


On Feb 4, 2006, at 7:03 PM, RJ Herrick wrote:

In validating my form input I look at my DB tables to see what  
types of input they will accept (valid values, maxlength, NULL ok,  
etc). This data is about the database, not the values coming in off  
the forms. It will stay the same until I alter my tables, which I  
won't be doing very often (in production at least :) ). So I'm  
looking to avoid gathering this metadata via DB calls every time I  
need to validate a form by instead using the cached metadata,  
stored somewhere by mod_perl. My thought was to put it into it's  
own namespace and have it available globally, loaded from one of my  
modules at startup.
Does anyone else understand what I'm trying to say? I apologize if  
I'm not expressing myself in the right vernacular.

Thanks,
RJ Herrick


Oh.  In that case... i put stuff like that in its own namespace  
during the startup.pl phase.


Suggestion though- (and this gets completely off topic)

it might make sense to have some sort of form builder/validator class

At the risk of making some people here cringe, in my projects I do  
something like


/Form.pm
/Form/account/registration.pm
/Form/account/settings.pm

where Form.pm is a base class that has my config data (ie, use  
libapreq for form parsing, db handles, etc) , and inherits from my  
form parsing class
registration would be a subclass of Form that has a symantic  
description like


our %Fields=(
'email' =>{
type=>'text',
'maxchars'=>'6'
...
'validators' => ['REGEX','SQL_FUNCTION'],
'validator_regex = 'email',
validator_sql = ['false','SELECT user_id FROM user WHERE user_id = ?;']
' validator_regex' => 'not an email',
'validator_email' => 'already registerd'
}
);

when I do a form validation, i just do:
my $form = Form::Account::Registration->new();
$form->validate();
if ( $form->has_errors() )
{
$self->printform;return;
}
my $email = $form->get_validated('email')

i do it in classes so that I can re-use the forms.  i had one project  
where I did a formfield class that had versions of every field used,  
and then i'd just specify while field description in the form class.   
but that saved me 2% memory while it gave me 30% more confusion.  so  
i said screw that.


there are a bunch of CPAN packages that do form validation like  
that , but most are focused on building , which can be overkill.




Re: Clarifying Q: Usage suggestions: caching DB metadata with mod_perl?

2006-02-05 Thread Jonathan


Well I couldn't use Data::FormValidator for my exact needs

There were too many if/else conditions I needed to implement into my  
form class that I couldn't do with its constraint and dependency  
system easily ( a bunch of multiple-field validations that would even  
change the valid repsonse sets .  its kinda messy in my system, but  
it works very easily to chain conditionals)


So I built my own heavily using parts from Data::FormValidator and  
FormBuilder


It's not nearly as robust or as good, but borrows a lot of code and  
ideas from both modules, so i wouldn't say that i reinvented it, but  
built from it.



On Feb 5, 2006, at 5:15 PM, Michael Peters wrote:


Looks like you're trying to reinvent Data::FormValidator.




Re: Answered: Need to clean MySQL handle attributes with persistant handle?

2006-02-13 Thread Jonathan


On Feb 13, 2006, at 1:39 PM, Perrin Harkins wrote:

Perrin- I would test this myself... except that, crazy as it  
sounds, I'm

not currently using mod_perl.


It doesn't matter -- you can test this from any old command-line  
script.

Just open a connection, do an insert that works, do one that doesn't
work (duplicate key or something), and check the isertid.


In my use, it doesn't even matter if DBI would cache the insert id or  
not:


My logic always looks as such:

10 insert OR catch fail and return w/error (rollback, setError ,etc)
20 implicit success - store insert id

I can't see any reason why you would continue with a transaction/ 
function if you're expecting a new insert_id and the transaction  
fails - you should catch the error and do the appropriate steps  -  
and not need to worry about looking for the insert id


Re: mp2 and httpd 2.2 - future plans / roadmap?

2006-02-16 Thread Jonathan


On Feb 16, 2006, at 11:53 AM, Perrin Harkins wrote:


Ohere's a set of instructions on how to download the source and add
things to it:
http://perl.apache.org/contribute/index.html

- Perrin


oh great!  its in svn too.

i'll send stuff to docs-dev asap.  thanks!


Re: A question for the newbies

2006-02-16 Thread Jonathan


On Feb 16, 2006, at 12:48 PM, Michael Greenish wrote:


What I like about PHP over perl is the ease of
variable declaration.  I feel I have to use strict
with perl, I would like the ability to not have to put
"my" in front of every new variable.


putting my / our before variables is good though.


is the templating.  I haven't found a template module
in perl that rivals Smarty templates in PHP.


Have you looked at Template::Toolkit ? Or Mason ?


any array element with ".".  Smarty plugin's are
great.  They help with creating select drop downs,
date drop downs.  I can capitalize, count, strip
template variables within smarty
All the perl templating engines allow that.  there's also FormBuilder  
and other things



so much more I can do with Smarty than with
HTML::Template.  Maybe I just missed all that stuff in
the documentation but again, I didn't find it.  Also,
it's much easier to include a code snippet in php than
in perl.
HTML::Template is a simple barebones templating system.  its not a  
robust approach like Smarty.  You should be looking at TT and MAson.



Today, Perl is still my personal favorite language to
code for web/unix task.  However at work, I am
implementing MVC in PHP 4 much like I did with Perl
using the basic OO capabilities available in 4.
Interface functions don't help in the web apps I do
(small - medium) so I don't see to much need for us to
move to 5.  But that's another topic.
I'd suggest looking at TAL the Template Attribute Language.  The  
specification is on the Zope website (python).  There are perl and  
php implementations (be warned though, the php version is a bit slow,  
so i suggest using a code caching system like eaccelerator with it).   
It's rather nice if you're doing cross-language development, because  
the same templates will work in just about any language.






Re: A question for the newbies

2006-02-16 Thread Jonathan

Just because I like to advocate TAL:


  
   First item?
   Even item?
   Odd item?
   Replaced by Foo{'blah'}{'var'}
   Replaced by Foo{'blah'}->method() 


 


template:
renders in browser without code, as it would be seen
is valid markup
works in multiple languages
has multiple perl implementations
	mini language is stupid and simple enough that designers don't have  
enough control to screw things up


On Feb 16, 2006, at 1:33 PM, Randal L. Schwartz wrote:


"Tyler" == Tyler MacDonald <[EMAIL PROTECTED]> writes:


Tyler> Why am I forced to say

Tyler>   [% FOREACH(blah) foo %]

Tyler>   Instead of the

Tyler>   [% for my $i (@foo) %]

Tyler>   I've become happily used to?

Because the day will come when you want to replace

foo.a # get $foo->{a}

with

foo.a # invoke $foo->a




Re: (slightly OT) postgresql? firebird? mysql?

2006-02-20 Thread Jonathan


mysql's innodb and mysql 5's 'improvements' should address a lot of  
issues with previous versions


that said, mysql and postgres are great.   (i've never used firebird)

there's beginning to be less of a difference between mysql and  
postgres as time progresses though


the mysql project essentially started with speed, and aimed for a  
full set of db features
the postgres project essentially did the opposite: support  
everything , but slow, then go for speed


i think the only annoying thing between migrated from postgres<- 
>mysql is the triggers vs auto_increment stuff


if your code uses a lot of insert_id from an auto_increment field,  
expect to go crazy tracking down all of your calls and creating  
triggers/serials/stored procedures to replicate that functionality




On Feb 20, 2006, at 3:27 PM, Tyler MacDonald wrote:


Daniel McBrearty <[EMAIL PROTECTED]> wrote:
I'm currently using mysql, but I'm considering changing over to  
firebird or

postgre.

Anyone have any reasoned loves/hates/useful experiences to pass on?


I love postgresql!

OK, to make it reasoned:

* Better license than MySQL, BSD-like license means it can be
embedded in commercial products if need be.

* Everything's journaled and transactional, which means the database
_may be slightly_ slower, but it's far more resistant to data  
corruption.


* slony makes it easy to cluster your database.

* People on the postgresql-general mailing list have been responsive
and helpful

* PL/PGSQL procedural language is fast and not too difficult to
learn (although the documentation could use some improvement, if it  
weren't
for my having easy access to a postgres mentor I'd have wasted many  
more

hours on this...)

* I dig the elephant logo.

- Tyler





Re: TIE

2006-02-23 Thread Jonathan
Most of these non- mod-perl centric questions can be answered faster  
with a lookup on perlmonks.org


oddly though, this list is bouncing today.

anyways, a quick search on gdbm on perlmonks likes to this node:
http://perlmonks.org/?node_id=405754

which links to this page from the camel book:
	http://www.mamiyami.com/document/perl_cookbook_2nd_edition/ 
0596003137_perlckbk2-chp-14-intro.html


note thats kind of old

personally, whenever i need to use a dblib, i use bekeley db
http://sleepycat.com/   
http://search.cpan.org/~pmqs/BerkeleyDB-0.27/
	http://search.cpan.org/~pmqs/DB_File-1.814/ 
DB_File.pm#Using_DB_File_with_Berkeley_DB_version_2_or_greater	


I think some version of bdb comes on rhel

On Feb 23, 2006, at 11:21 AM, Ronald J Kimball wrote:


On Thu, Feb 23, 2006 at 10:27:35AM -0500, Mark Galbreath wrote:

looks way cool - thx Chris.  Does libgdbm come with perl distros?  I
notice the man page is already on my RH Enterprise 4 client.  The  
reason
I ask is that it is very painful to get the government to change  
anything
on a server without lengthy and exhaustive QA.  I'd like to start  
using

stuff like this before 2010.  :-)


You don't have to use gdbm.  You can use whatever library you've  
been using

with dbmopen().

If you do have gdbm, GDBM_File would be a good choice.  Other options
include DB_File, SDBM_File, and NDBM_File.

AnyDBM_File has a comparison of the different libraries.

Ronald





MP2 on FreeBSD - How often to update Apache/MP/Libapreq/Perl?

2006-02-25 Thread Jonathan
I decided to upgrade my production box last night for some apps (its  
FreeBSD 6.0 )


not fun.

the port system does a great job , but without me realizing it, i had  
set Perl  to upgrade as well


which means i'm now sifting through all the errors and manually  
deinstall/reinstall things that couldn't be automated


this makes me wonder -- how often do you all upgrade your ports for  
MP2 dependencies (ie apache2/perl)?


this is really just a 'best realistic practices' question.

it would be nice to have everything at the lastest version, but in  
all practicality, one can't do that.


Re: [OT] modperl vs. Ruby

2006-02-25 Thread Jonathan


there's been a popular link critiquing rails floating around

http://discuss.joelonsoftware.com/default.asp?joel.3.309321.3

personally, I hate rails.   i'm seeing a lot of colleagues adopt it,  
with a combination of this reasoning:

it 'sucks less than php'( from someone with a php book )
its perfect for doing small sites regardless of traffic
remember, there are 2 types of scaling :
a- lots of users / content
b- lots of hits
		rails can scale on b reasonably well behind lighty w/fcgi.  just  
loadbalance and toss server after server into a cluster.

the bulk of its use is design shop stuff

but all my colleagues/friends work for design shops

not to knock rails, but the biggest project they've been implemented  
with , as far as i can tell, is odeo. lots of other projects are done  
in it, but none that scale in use and content like that one, and it  
doesn't really impress me.  there could  be something else out there,  
but i've yet to see it.  all the projects i've seen done on it are  
blogs, small sharing apps, design agency stuff, etc.  it does that  
stuff really well and really fast, but there's no breadth to it.   
AFAIK the big blog implementation service that touts rails is run as  
multiple installations each behind their own lighty instance with  
fcgi support.


this fall, I quit my FT job to start an online sharing / syndication  
service that will hopefully go live within the month.


i evaluated a ton of frameworks and languages, here's how i felt:

	ruby - rails was getting all the hype. i tried rails and had a  
webapp running in minutes.  it was a sheer pleasure as promised.   
except rails couldn't do what i wanted to do for my project.  it was  
way to strict. its made for building a certain type of application -  
not every application.
	c - would have been the fastest to run and scale the best.   
nightmare to write.
	php - i found it a nightmare to maintain code and enforce MVC, and i  
intensely dislike the model of everything essentially being a cgi  
script.  i wanted everything compiled into the server, as i'm running  
a single service, not 20 differentn projects for 20 clients like I  
managed at my old design agency.
	python - the spec on the  twisted framework kept changing.  django  
was too Rail's-ish in scope.  turbogears didn't exist yet, but also a  
bit too rails-ish for me.
	perl - i don't like template toolkit or mason.  i know many do.  i  
just don't.  they're both very perlish in the templates.  catalyst  
wasn't really around yet - maypole was, but also too rails ish.


i ended up building my own MVC 'framework' under mp2.  i get all the  
speed and server integration that I wanted.   i'm tossing framework  
in quotes, because everything is too built-into my app.  i'd love to  
pull it out and release it, but its not there yet.  it basically just  
does url dispatching to perl modules + session control in a  
standardized manner, and has an abstracted api for content  
rendering.all html pages are written TAL, because I  use python  
to prototype objects and methods and handle admin tasks.  this lets  
me use the same exact templates for prototyping.one might  think  
that perl or ruby is fast/easy to write - well (for me)python is a  
fraction of it -- and program/test in python than port to mod_perl is  
way faster (again for me than ) doing everything in mod_perl.


i think the reasons why rails gets so much hype are this:
	it makes building a certain type of project easy.  those projects  
are 'popular' as are the companies building them.  so when people  
talk about it, others listen.
	its gaining a lot of ground w/newcomers to web building, as its easy  
and intuitive.  so more people talk about it.
	it converts a lot of people from .NET or java, who hear the hype and  
give it a shot.  truth be told, they find it a dream.  who wouldn't  
after that conversion?


so depending on what  you're building, RoR may be the best framework  
for you, or a complete nightmare.  its certainly not the jack-of-all- 
trades, and neither is catalyst.  using any framework or language,  
your milage WILL vary compared to others.



On Feb 25, 2006, at 5:23 PM, Mark Galbreath wrote:


which then begs the question, why RoR and not Catalyst?


Re: Apache::Session::MySQL lock troubles

2006-02-26 Thread Jonathan

looks like DBI stops talking to mysql

when this happens, is apache hanging?

or does it just crash on one page, and then continually crash on  
subsequent pages?


a few ideas:
a
are you using the same dh / $dbh for session as the rest of 
your site?
if so, try creating a new mysql db for sessions only.
there could be some locking issue caused by other queries.
b
are you using Apache::DBI or another persistence provider?
		i'm thinking that *maybe* you're not, and mysql is unhappy that  
you're slamming it with constant connects.


c   
		if this is a dev box, try enabling the query log and slow log in  
mysql, and enable tracing in DBI
		if you can reproduce, see if mysql is logging it as a slow log, and  
see if mysql or DBI did something that didn't unlock a table
		be warned though - mysql query log can grow gigantic, and DBI  
tracing can be verbose


d
		assuming you're on a nix/bsd ( there were some files in the root of  
that page that suggested such) tail the logs while you stresstest.




On Feb 26, 2006, at 4:29 PM, Todd W wrote:

Apache::Session is occasionally hanging pages. If I stop the  
server, I find

the following in the error log:

http://waveright.homeip.net/~trwww/code/pmsi/4tp-bug.txt

using pre and post statment warn()s, I found that the line that  
causes the

hang is:

  eval {
  tie %{$session}, 'Apache::Session::MySQL', $session_key,
   { Handle => $dbh, LockHandle => $dbh } ;
 } ;

The only way I can "duplicate" it is by pounding the sever with ab.

Once it hangs, it says hung ( can't make any other requests ). A  
restart

always gets it going agian.

Thanks in advance for any advice!

Todd W.







Re: Apache::Session::MySQL lock troubles

2006-02-26 Thread Jonathan


fyi , you can also see that in a regular mysql client

show processlist

this could also be a pure mysql problem.  mysql is a fast db, but its  
got some weird bugs.


i kept having issues with a collation matching problem on a table,  
because I needed to change the column defaults from latin_swedish_ci  
to utf8_general_ci .
toggling table defaults or db defaults wouldn't do a thing.  neither  
would creating/dropping the col, table or db.
apparently its an issue with the way mysql stores and alters column  
definitions, and doesn't overwrite or update them properly.   the  
only known fix ?  delete & reinstall mysql at that version, or  
upgrade from 4.x to 5.x


so i upped to 5.x.  which actually solved a few other weird issues i  
had.



On Feb 26, 2006, at 5:51 PM, Todd Finney wrote:


At 04:29 PM 2/26/2006 -0500, Todd W wrote:
using pre and post statment warn()s, I found that the line that  
causes the

hang is:

  eval {
  tie %{$session}, 'Apache::Session::MySQL', $session_key,
   { Handle => $dbh, LockHandle => $dbh } ;
 } ;


When this happens, what does `mysqladmin processlist` tell you?

I had a similar problem with freshly installed debian sarge box a  
couple of months ago.  I'd attempt to tie the session, and the  
process would hang.   `mysqladmin processlist` would show "SELECT  
GET_LOCK('Apache-Session-[numbers])".


I poked around for clues, and saw a few other posts that indicated  
that it might be a scoping problem.  Nothing in my code jumped out  
at me, though.  Besides, the exact same code has been running on  
another production box for at a few years now without a problem.


I was in a hurry, so I just moved to another machine and carried  
on.  I haven't gotten back to look at it yet.







Re: Apache::Session::MySQL lock troubles

2006-02-26 Thread Jonathan


how many connections do you get from a show processlist in mysql?

is it possible that some scoping issue had the connect occuring  
during prefork, instead of postfork, and mysql is dying from apache  
trying to do everything via 1 persistent connection?


 


configuration question

2006-04-23 Thread Jonathan

I've got a question on a setup

right now, i have modperl set up as such:


PerlRequire /path/to/startup.pl
PerlSetEnv PERL_RLIMIT_DEFAULTS On
PerlModule Apache2::Resource

SetHandler 'modperl'
PerlResponseHandler 'myapp::api'




of course there are a bunch of location blocks - /api/ , /account/ etc

I need to move api (and a few other items) from /api/ to  
api.mydomain.com


naturally, that means a new virtualhost container

my question is this - api and a the other items still share 95% of  
the code base, including the configuration variables that are loaded  
in startup.pl


what's an efficient way of keeping everything maxxed on shared memory?

my first thought was to do (xmlish to save typing)


PerlRequire /path/to/startup.pl





except that would be too easy.  see mp isn't serving these items  
directly - this is a multi-server setup.  so *most* requests are  
coming from 127.0.0.1, but others will hit the real domain.


can anyone offer a tip?  i'm thinking that the only thing to do is to  
bind each handler to a different port and a different vhost.








Re: perl CGI problem

2006-04-23 Thread Jonathan


On Apr 24, 2006, at 12:01 AM, Philip M. Gollucci wrote:

I have a standard formmail perl routine taken verbatim from matt’s  
script archive.  It works.
Expect that matt's script archive is ancient, and has serveral  
known security vunerabilties. Use at your own risk.


When I read the original post I cringed.  His stuff has gotten more  
secure over the years, but he's still one of the top targets that  
script kiddies cut their teeth on looking for vulnerabilities  
(although php gallery still seems to be #1).  Its a real 'at your own  
risk' thing, and I'd suggest looking at other options.

using mod_perl to debug apache?

2006-04-24 Thread Jonathan


something is odd with my mime types on a custom apache install.   
sometimes text/css is text/css, other times its sent as text/html  
(which firefox hates)


since i have mp enabled on this server, and mp can plug into apache  
just about anywhere, i'm wondering if anyone would know of a way to  
use MP to debug this ( or a similar problem )


ORMs under mod_perl

2006-05-17 Thread Jonathan
i'm running really behind schedule on something, so i need to use an  
ORM to get it off the ground quick ( i generally hate them and prefer  
pure  sql)


doing some searches online, I found some issues with mod_perl and  
Class::DBI from about a year ago -- does anyone know if they're still  
around or if they've been solved?


also, does anyone know about dbix::class under mod_perl?  any issues  
there?


thanks.


$c->remote_ip

2006-05-21 Thread Jonathan


I've got a question about remote_ip from Apache2::Connection

testing on my local mac network @home, its giving me addresses like  
such:

fe81::2333:25ee:ffb2:b244

I'm not really sure what that is.. it kind of looks like ipv6, but  
kind of not.


in any event, testing on external machines, i'm getting ipv4 numbers   
(ie 192.168.1.101)


anyone know how to force an ipv4 ?




//Jonathan Vanasco

|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - -

| RoadSound.com / Indie-Rock.net
| Collaborative Online Management And Syndication Tools
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - -






Re: Slightly OT: mp2 oriented Captcha Module -- anyone interested ?

2006-06-06 Thread Jonathan
forgive the continued OT-ness, it makes sense to just continue this  
for another post or two here...


On Jun 6, 2006, at 5:10 AM, Kjetil Kjernsmo wrote:

a lot of good points



i agree 100% with everything you said.  its awful for users, and its  
awful for the server load - which is why i want to make it as modperl  
as possible.


i'd rather not use images, but right now they're 'easiest' and expected.
i want to implement one captcha system, and then just have a modular  
element handle how the challenge is presented...


i should have something usable for input within 18hours via Trac/SVN.  
its a bit awkwardly laid out classwise, as i'm pretty much porting  
from a half-finished python version and both langauges have very  
different approaches to class inheritance.


i don't mean to use cheaply implemented / replaced / upgraded plugins  
for image generation , but for all presentation formats.  ie, you can  
switch between different image outputs if your want... or between  
jpeg/text-logic with a single line of code


basically the idea for use is this:

# build a new captcha
my  	$captcha= Captcha::NewCaptcha->new( sitesecret=>'a-z', seed=>'A- 
Z' );
my 	$publickey= $captcha->generate(); # public key is used to  
generate the captcha test


# validate the captcha
my  	$captcha= Captcha:: ExistingCaptcha->new( sitesecret=>'a-z',  
seed=>'A-Z' );
if  ( !$captch->validate( public_key=>$publickey , human_answer=> 
$human_answer ) {

die "invalid key";
}

# generate the captcha using a factory pattern
my  	$captcha= Captcha:: ExistingCaptcha->new( sitesecret=>'a-z',  
seed=>'A-Z' );

my  $jpeg_data= $captcha->render( 'image' );
my  $html_logic_field= $captcha->render( 'html_logic' );
my  $wav_data= $captcha->render( 'sound' );

# i chose a factory dispatch instead of calling a variation directly,  
because some captchas may have several versions called at once...


all of the output options are separate and modularized.  ie:
Captcha::Img
Captcha::Sound
Captcha::Logic

but share the main Captcha interface and inheritance

captcha keys so far work like this
public_key= md5( sitesecret , seed , timenow );
	question/answer = generate_pair( key ) ; # where a given key will  
always return a specific pair


	something presented to the user ( a text puzzle, a visual captcha, a  
sound ) has embedded with it 'public_key' and 'timenow'

captcha.gif?public_key=2384u20983u4234&time=10001

	timenow is valid for ( cpu - 30s ) - ( cpu + 240s ) which is 30s in  
the past and 4mins in the future
	sitesecret is configured per-site, defaults to '' -- just to add a  
minimal layer of security

seed is a session variable supplied by the calling program

this makes a GENERAL key that can provide a turing authentication  
with a built in self-destruction time of 4.5mins (time can be  
changed, but that should account for casual use of a computer plus a  
cluster of machines that are out of sync and not running ntp )


to make things secure, keys SHOULD be checked into/outof a db -- but  
that makes more sense to me in the calling program, not a generation/ 
validation module.  i think a captcha system should just generate a  
test and validate it.  whether or not a test has been used before, or  
if an ip has called for 300 tests in 10seconds, or if a test was  
given to ipA and answered by ipB,C,D shouldn't be in the module.  its  
too user specific to put in there (i think) - or at least in the main  
module.


in any event, thats my approach so far - i can implement most of it  
right away with an image test that everyone will find annoying and  
some will feel disfranchised by... but with a few lines in code I can  
switch it to audio or text-logic as those parts get written.   
( though its not as extensible as i'd like right now.. i'd like to  
support multiple image rendering options).




//Jonathan Vanasco

|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - -

| RoadSound.com / Indie-Rock.net
| Collaborative Online Management And Syndication Tools
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - -






Re: Question about mod_perl 2 and Perl CGI form processor

2006-06-08 Thread Jonathan


On Jun 8, 2006, at 3:11 AM, Tom Williams wrote:

and I noticed I'm not getting a new worker process after the form  
is sent, which is possibly fine.  I'm suspecting the Apache process  
where the script ran is hanging out and contains the old form data  
in its environment so that when I submit a new form, the new form  
data is appended in the same environment the previously run form  
ran in. Make sense?


Is any of this related to mod_perl or is this an Apache 2 worker  
MPM issue?


its because you're running a poorly written cgi-script in mod_perl.   
chances are it doesn't 'use strict' or warning, and it doesn't  
instantiate any or all variables with a scope.


i can't seem to find it in the docs... it was well documented in 1.x,  
maybe the text lost its way into 2.x?


in any event...

the apache processes isn't hanging out, its doing what it should:   
since mp compiles and caches code to be a persistant environment and  
doesn't 'exit', if a variable is left unscoped or poorly scoped, it's  
not destroyed before the next run.


bad example, but:

script A:
if ( $a ) { $a+= 1 }

script B:
my $a;
if ( $a ) { $a+= 1 }

in script A, every time mp is run, $a is incremented.  a is never set  
to 0., so it just += from the last value (which was $a at the end of  
the last request )

in script B, every time mp is run, $a is initialized (my $a )

in order to get your expected behavior, you'll have to 'use strict'  
and go through the code you downloaded making sure everything is  
scoped right, using my/our/local and blocks as necessary.


make sure you initialize/instantiate all of your variables or just  
expect thigns to not work.


that said...

running mod_php and mod_perl together is a nightmare in terms of  
memory management.  my advice is don't do that.  push the php out via  
fastcgi , proxy it to lighty/fastcgi, or run apache on different  
ports- one with mod_php loaded, and the other with mod_perl.


see:

http://perl.apache.org/docs/2.0/user/coding/coding.html#Cleaning_up
	http://perl.apache.org/docs/general/perl_reference/ 
perl_reference.html#myScoped_Variable_in_Nested_Subroutines





//Jonathan Vanasco

|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - -

| RoadSound.com / Indie-Rock.net
| Collaborative Online Management And Syndication Tools
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - -






Re: GDGraph and mod_perl

2006-06-25 Thread Jonathan


On Jun 25, 2006, at 4:00 PM, Chase Venters wrote:


You could try disabling GD support in PHP.


better yet, don't use mod_php and mod_perl at the same time.  fucking  
mess of symbol collisions, plus poor performance and memory management.


proxy php stuff to lighttpd (http://www.lighttpd.net ) running php- 
cgi .  you'll get at least identical performance to mod_php under  
apache, and you can jail the sucker easily (which is pretty much  
required if you use any open source php apps).  toss in eaccelerator  
in cache only mode, and you blow mod_php performance away.



//Jonathan Vanasco

|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - -

| RoadSound.com / Indie-Rock.net
| Collaborative Online Management And Syndication Tools
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - -






question: ssl login

2006-07-10 Thread Jonathan


i need to lock down a login/registration/password system under ssl

i've never done this stuff before

the mod_perl ssl stuff is a bit lacking in docs, so off of things  
i've read in misc places and the 1.0 guide, i have a few questions:


a- is this correct:
the recommended place to run ssl through is some sort of proxy?
ie:
		internet ||| ->  Load Balancer ( ssl ) -> cluster ( mod_perl /  
vanilla / etc )
		internet ||| -> Apache Port 80/443 ( ssl + vanilla ) -> mod_perl  
( port 8000 )
		internet ||| -> Lighttpd Port 80/443 ( ssl + vanilla ) -> mod_perl  
( port 8000 )


b- 	in that scenario, is there any way to make sure that a login  
happened via SSL ?
	the $ENV{HTTPS} , like in the mp docs , would only be set if we were  
using the same modperl for both 80 and 443 and serving directly,  
correct ?


any pointers would be greatly appreciated.

//Jonathan Vanasco

|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - -

| RoadSound.com / Indie-Rock.net
| Collaborative Online Management And Syndication Tools
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - -






Re: Authentication

2006-08-05 Thread Jonathan


On Aug 5, 2006, at 6:07 AM, Radoslaw Zielinski wrote:


Thanks for explaining, I wasn't aware of cases like this.  For some
reason, I thought you mean clients on some crazy PPP link which breaks
once every few minutes.


yeah, its extremely common with ISPs in the US.

its also common with businesses: In the past I've worked in a number  
of offices that use similar systems : a T1 ,  coupled with a cable  
modem installed as backup (not dsl, as the same company handles the  
local loop for t1 and dsl, so it can't be used as backup), are linked  
to an internal gateway / firewall that load-balances requests into  
both connections.


Re: issue with DBD::Pg, server side prepares, and persistent connections?

2006-08-05 Thread Jonathan

this is more of a discussion post than a response:

On Aug 5, 2006, at 10:02 AM, Mark Stosberg wrote:

do you have links of that in regards to dbd::pg?  i didn't realize  
they supported it.


However, when deploying it on mod_perl on a busy website, I quickly  
saw a lot of this kind of error:


prepared statement "dbdpg_7" already exists


from my experience with psycopg ( python pg interface ) it is the  
persistant connection issue.  obviously , you're trying to prepare a  
statement that has already been allocated.  but i'm wondering how/why  
that's happening.



I found a related mention of this issue here:
http://fudforum.org/forum/index.php?t=msg&th=4598&start=0&;

There the fix involved putting using DEALLOCATE when persistent


first, the patch with DEALLOCATE makes prepared statements entirely  
useless, as it means you're caching a prepared statement, running it,  
then deallocating it immediately afterwards.   thats some brilliant  
php right there.  why didn't they just do a conditional to never  
prepare on persistant connections ?


before looking into how dbd::pg is internally handling the prepared  
statements, are you using some sort of db abstraction layer like rose  
or class::dbi.or are you executing directly?  if executing  
directly, are you creating statement handles on the outset, or are  
you just letting dbdpg handle all of that internally?


the prepared statement 'handle/name' is private to the session.  so  
two different connections will each have their own statement handle.


my guess on things to look into:
how is dpd::pg caching the statement handle?  are they even doing it?
	where is the statment handle being cached, accessed, checked?  in  
the memory space of the child, or in the shared area?






// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -

| FindMeOn.com - The cure for Multiple Web Personality Disorder
| Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -

| RoadSound.com - Tools For Bands, Stuff For Fans
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -





Re: Apache2::AuthCookie

2006-08-06 Thread Jonathan
based on everything that philip mentioned, my guess is that the  
modules are not being imported correctly


personally, i solve lib issues in mod_perl as such: i have a 'use  
lib' line in startup.pl that calls in my handler lib, and various  
external libs



use lib qw(
/webserver/sites/FindMeOn.com/web-modperl/lib
		/webserver/sites/FindMeOn.com/web-modperl/lib-externals/Authen- 
PluggableCaptcha/lib/
		/webserver/sites/FindMeOn.com/web-modperl/lib-externals/Apache2- 
xForwardedFor/lib/

/webserver/sites/FindMeOn.com/web-modperl/lib-externals/P_2XLP
);


thats in the startup.pl file for my local machine.
my production box is freebsd, which has root in /usr/local/www/sites/ 
FindMeOn.com/web-modperl







Re: FreeBSD mp related updates

2006-08-07 Thread Jonathan

On Aug 8, 2006, at 12:20 AM, Philip M. Gollucci wrote:


FreeBSD mp related CPAN modules / PR / updates:

http://www.freebsd.org/cgi/query-pr.cgi?pr=101537
Synopsis:   devel/p5-B-Size now require perl 500600 or higher

http://www.freebsd.org/cgi/query-pr.cgi?pr=101539
	Synopsis:   Update: www/p5-Apache-DBI 1.00 -> 1.02, fix  
download URL


Apache-DBI 1.02 was released to CPAN
Fixes a typo in the debugging

Apache-Peek 1.06 was released to CPAN.
Fixes perl 5.8.8+ compiles

An Apache-Peek FreeBSD port PR is forth-coming,


AWESOME THANK YOU.


// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -

| FindMeOn.com - The cure for Multiple Web Personality Disorder
| Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -

| RoadSound.com - Tools For Bands, Stuff For Fans
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -





MaxClients and Apache::DBI ?

2006-08-08 Thread Jonathan

I'm running prefork as such:

StartServers 5
MinSpareServers  5
MaxSpareServers 10
MaxClients75
MaxRequestsPerChild  1


Using ab, I benched a page that has 3 db handles:
session
read
write

session has 1 connection of its own.   read/write are currently  
sharing a single connection until they cluster.


my postgres is set to 200 connections max


so here's whats odd (benching 5000 connections):

benching 10 concurrent connections- no problem
benching 100 concurrent connections- things seem fine for the first  
few hundred connections.

around 400 though, i start getting DB errors.

if i do a quick "select * from pg_stat_activity " it shows me 198  
connections ( 2 reserved for admin )


i can't figure out how this number is so large.

max clients (75) + max spare servers (10)= 85 (i 'm not even sure it  
can jump up to 85 like that.  shouldn't it max as 75?  or is that  
only for active clients)

85 * 2 ( 1 session , 1 read/write ) = 170

what math am i missing there that will account for another 30+  
connections that its trying to make?


at first I thought I had a some errors in my perl code re:  
connections, but I only have a single connection made with the  
session handle via apache::session & connect_on_init .


for whatever reason, i seem to be creating 99 session and 99 read/ 
write handles


anyone have a clue?


Re: Redhat up2date breaking mod_perl installation?

2006-08-11 Thread Jonathan


Your box is now running
apache: httpd 2.0.52 28.ent i386
perl:   perl 5.8.5 36.RHEL4 i386

i don't see any mod_perl port (httpd-perl /modperl/etc)

my guess is that mod_perl was compiled from source, against the old  
perl and the old apache, because there is no mod_perl port in that  
list, and when you rebuild perl or apache, you have to rebuild mod_perl.


you also likely changed perl versions-- which means your perl  
installation is likely fucked up


freebsd has an 'after upgrade' script for perl that migrates modules  
to the newly installed version.  look to see if redhat has something  
similar.


in either event, 


Re: Redhat up2date breaking mod_perl installation?

2006-08-11 Thread Jonathan


On Aug 11, 2006, at 7:06 PM, Mark Hedges wrote:

This happened to me when running up2date on rhel4 too.

Had to re-install all CPAN modules.

We used Apache2/Mod_perl2 compiled from source because the
RedHate vendor lib distrib of Apache2/mod_perl1.99 and savagely
hacked libraries suck eggs and serve no purpose other than to
rope your organization into their platform.


You know, a big plus that I've enjoyed recently on FreeBSD is this:

August 9, 2006 8:21:49 PM EDT
From [EMAIL PROTECTED]
[ANNOUNCE] libapreq2-2.08 Released

Thu, 10 Aug 2006 09:30:16 GMT
From [EMAIL PROTECTED]
Update: www/libapreq2 2.07 -> 2.08, portlint fixes, update 
pkg-plist

Before I even got a chance to download the libapreq update, Philip  
ported it to freebsd too.


When you're stressed and overworked, you have no fucking clue how  
awesome that is.


FreeBSD is just too damn good.



Re: apache2::Status & B::TerseSize

2006-08-11 Thread Jonathan


On Aug 12, 2006, at 2:16 AM, Philip M. Gollucci wrote:


I generally just do this:

  SetHandler perl-script
  PerlResponseHandler Apache2::Status
  PerlSetVar StatusOptionsAll On
  PerlSetVar StatusDeparseOptions "-p -sC"


which is what you wrote.


when you do that, do memory  stats work for the 'front page' and top  
levels?  they don't for me, but the do for everything else.


the docs suggest tossing a
PerlModule B::TerseSize
before the block.  if you do, thats when the error happens.  has  
nothing to do with graphvis





Re: apache2::Status & B::TerseSize

2006-08-12 Thread Jonathan



I'm finding some issues with the 2 modules

i think some of it happens when you have a module that has no  
subroutines ( ie , a namespace placeholder or something )


check out ~ line 551 in Apache2::Status

adding a few over-the-top checks seems to help, and gets memory use  
working on more items


} (sort { $subs->{$b}->{size} <=> $subs->{$a}->{size} } keys % 
$subs);


+   return if ! scalar @keys;
+   return if ! defined $subs->{$keys[0]};
+   return if ! defined $subs->{$keys[0]}->{count};
+   return if ! defined $subs->{$keys[0]}->{size};

my $clen = length $subs->{$keys[0]}->{count};
my $slen = length $subs->{$keys[0]}->{size};


i'll have more fixes as time progresses


Re: apache2::Status & B::TerseSize

2006-08-12 Thread Jonathan

ok, also found

I also figured this out:

in B::TerseSize, line 634

- my $script = $q->script_name;

+ my$script ;
+ if ( defined $q && $q )
+ {
+   $script = $q->script_name;
+ }

Killing that makes a lot more things work too.

The only caveat of that, is that 'memory usage' doesn't appear on / 
perl-status/ until you visit a symdump page that contains memory- 
usage.  i don't know why.  but that should only happen on situations  
already afflicted by the other bug.  so its a stupid new bug instead  
of a bad old one.





Re: Prefork not sharing on FreeBSD, but sharing on OSX ?

2006-08-12 Thread Jonathan


On Aug 12, 2006, at 10:10 PM, Philip M. Gollucci wrote:

What are you using to measure this on each ?


ok.   this is f'd up

i tried Gtop on my production box (FreeBSD 6)- the children were 16mb

meanwhile,  top is showing me this:
www  97088  0.0 25.3 260548 254976  ??  I12:42AM   0:00.02 / 
usr/local/sbin/httpd
www  97089  0.0 25.3 260548 254976  ??  I12:42AM   0:00.02 / 
usr/local/sbin/httpd
www  97092  0.0 25.3 260548 254976  ??  I12:42AM   0:00.01 / 
usr/local/sbin/httpd
www  97098  0.0 25.3 260548 254976  ??  I12:42AM   0:00.02 / 
usr/local/sbin/httpd
www  97099  0.0 25.3 260548 254976  ??  I12:42AM   0:00.02 / 
usr/local/sbin/httpd
www  97101  0.0 25.3 260548 254976  ??  I12:42AM   0:00.02 / 
usr/local/sbin/httpd
www  97105  0.0 25.3 260548 254976  ??  I12:42AM   0:00.02 / 
usr/local/sbin/httpd
www  97107  0.0 25.3 260548 254976  ??  I12:42AM   0:00.02 / 
usr/local/sbin/httpd
www  97109  0.0 25.3 260548 254976  ??  I12:42AM   0:00.02 / 
usr/local/sbin/httpd
www  97112  0.0 25.3 260548 254976  ??  I12:42AM   0:00.01 / 
usr/local/sbin/httpd
www  97119  0.0 25.3 260548 254976  ??  I12:42AM   0:00.02 / 
usr/local/sbin/httpd
www  97120  0.0 25.3 260548 254976  ??  I12:42AM   0:00.02 / 
usr/local/sbin/httpd
www  97122  0.0 25.3 260548 254976  ??  I12:42AM   0:00.02 / 
usr/local/sbin/httpd
www  97126  0.0 25.3 260548 254976  ??  I12:42AM   0:00.02 / 
usr/local/sbin/httpd


i've somehow gone from 50mb processes to  250MB ones
also, apparently, i have roughly base 300% memory (not base 100%  
like.. the universe )


i tried running
top -Uwww

I'm seeing multiple processes with
255M SIZE
249M RES

so i'm just  going to  ask  this instead

1)  what is typical of a webapp under mod_perl  in terms of memory ?
2)  how the hell do you measure that memory, under osx and freebsd ?

everything i'm using to measure memory is giving me DRASTICALLY  
different numbers.


the custom framework I wrote isn't crazy big - its 120k of  perl that  
really just wraps Petal, Rose, and provides extensibility to just jet  
them and choose another component. i'd say 30% of the overhead in it  
is debugging calls, and Apache::Status shows it as about 1.3mb of  
compiled code.the business object of the webapp is *maybe* 300k  
of perl and petal documents.  so maybe 2mb of perl?





Re: mod_perl2 installed, but scripts slow

2006-08-20 Thread Jonathan
i'm not going to speak of the mod_perl install setup, but I will say  
this:


it sounds like a lot of the  speed issues have to  do with compile  
issues.


mod perl speeds up serving content by caching the perl modules.
most people use a startup.pl file that is included from httpd.con in  
a PerlRequire option.  The startup script will preload all of the  
Perl modules into mod_perl (ie: Petal / MkDoc / etc ).  On top of  
that, people will also run a perl routine to compile the Petal  
templates.  That pushes the  time required to  compile the modules  
from the first request into the startup phase of apache.





Re: Prefork not sharing on FreeBSD, but sharing on OSX ?

2006-08-23 Thread Jonathan

On Aug 23, 2006, at 3:51 PM, Philip M. Gollucci wrote:


load nothing, except maybe Apache::SizeLimit

...
I'll try that tonight

I'm betting that top/ps are going to be off and the RUSAGE() will  
be correct

I'm not convinced that they report Copy-on-Write pages correctly

i've been profiling with top/ps , RUSAGE (BSD:Resource), and GTOP.
all 3 give me waaay different numbers.  off by 10s of mbs each.

The low amount of shared memory on all these setups makes me wonder  
though.


First off, Jonathan T and are running the same setup and compile  
options.  I believe its just the stock apache 2.0 port off freebsd.


Philip is running apache2.2 and has this flag on his compile that we  
do not "-D APR_USE_PTHREAD_SERIALIZE"


my osx has that flag, freebsd does not , and osx is sharing 2x the  
memory as freebsd.


philip has more memory sharing than me,  but not as much as Jonathan T.

have either of you profiled the memory sharing on another platform?
( ie, local osx or linux box )


i need to set up a spare box tonight and see how this code operates  
on debian.


from what i can tell , something is definitely broken on freebsd.   
Either the memory is sharing and the bsd tools are not reporting it  
correctly (entirely plausible.  i can't get a consistent answer from  
any method ), or something in the way apache/perl is built is causing  
the memory to not share as much as it could/should.



root60641 22.6  5.8 73068 60492  ??  Ss8:25PM   0:02.08

73MB thats nothing for mod_perl + php its fairly typical actually.


i'm going to patch docs to say that.  the mp docs + mp book + devel  
cookbook are a bit misleading- they suggest that 12MB of parent + 5mb  
child is typical.  its really not.



These numbers seem really high to me. I have both mod_perl and  
mod_php installed and am running two perl sites and four php sites.
You should separate these out to separate apache instances  
unless you've a good

reason not to.


unless you need some random apache module for php permissions, i'd  
strongly suggest removing mod_php altogether.  run php via fastcgi+  
eaccelerator, and serviced by nginx or lighttpd (just set a cronjob  
to restart lighttpd at 3am every morning, its got a nasty memory leak  
right now).  you'll see a gigantic performance boost- both in  
mod_perl and on your php sites.





Re: Prefork not sharing on FreeBSD, but sharing on OSX ?

2006-08-23 Thread Jonathan

On Aug 23, 2006, at 6:05 PM, Jonathan Tweed wrote:

I'm not clear on how these numbers are interpreted, but it looks to  
me that the FreeBSD is allocating all 30MB at startup. Have I  
missed something in httpd.conf that will cause this? It also looks  
like 64656 has been replaced by 64835 but I don't see any errors in  
the error log.


First off, I get the exact same behavior in terms of sizes re: osx /  
freebsd -- which is why I started this.


In terms of the 30MB-- take off sizelimit,  and you'll see the  
numbers.  Apache::Sizelimit doesn't seem to have any effect on freebsd.


If I then modify the handler to return the $max_rss and $max_ixrss  
from BSD::Resource:


BSD resource seems f'ing broken too.  note that i also said i get a  
different size in memory from every measurment app i tried.



Where did 163MB come from?!
163 is about the resident memory size of the parent ( 60564 ) , and  
the child ( 101764 ).


its also possible that its 60mb child res, 100mb parent res, and 3mb  
child res on the process you didn't request yet-- if you hit it again  
until you hit the other process ( log $$ to STDERR and tail it until  
you see 2 seperate processes ) can you bump up to 220 ?


that doesn't solve whether or not the reporting is bad or  actual  
memory sharing is.


On OS X it said both were 0, which I presume means it doesn't work  
properly on OS X.


osx is severely crippled.  cpu /user time works for getrusage.  thats  
it.   top doesn't even work right on osx.


I've been meaning to do something like that for while, but I work  
on something else during the day so my only reason is a lack of  
time. What benefits can I expect from doing this? The only things  
that searching have turned up are that a years ago they stamped all  
over each other but I haven't had any such issues so I assume that  
has been fixed.


the big benefit is that apache is slow, apache is a memory hog.   
every php hit you process with apache is less time/memory for apache  
to focus on mod_perl.


fastcgi + eaccelerator (cache only mode.  code optimizers will break  
all your code )  is about 20% faster than mod_php  with no  
eaccelerator.  ( eaccelerator will compile a memory  cache of your  
php code.  16mb of memory dedicated to that got PHPtal- the slowest  
templating system in the world - working as fast as 'print "hello world"


if you're only running php on the box, then the benefits of migrating  
from apache  aren't all that  great.  the big benefit is just freeing  
up more cpu and memory for mod_perl.



On Aug 23, 2006, at 6:10 PM, angie ahl wrote:


I'm running MP2/Apache2 on FreeBSD 5.3 and under OSX (10.4.6) and my
can you dist upgrade to 6.0 ?  i dont know if 6.1 is stable for  
apache/postgres yet (pg did not like it 2 months ago), but the 5.x  
branch of freebsd is kind of nightmarish.  i wouldn't be surprised if  
your segfaults had to do with something in freebsd.


also , are you using Apache::Reload ?  I've found a lot of segfaults  
stem from that under freebsd ( but not under osx ).  chances are you  
have some module in there that doesn't like your environment.



I'm seeing huge problems with uploads which is something to
investigate further. I've been forced to remove the from modperl
are you using libapreq?  that should cut down.  i believe that you're  
seeing an expected behavior though.  that should just be process  
growth, not memory loss.  if you load a 10mb file, then a 5mb file,  
you should see a growth of 10mb, then 0 mb.  if you load a 5, then a  
10, you should see a growth of 5 and 5 respectively.



having 3 seg faults a minute doesn't help as an apachectl gracfeul
doesn't get the ram back like it does on my OSX server. I just thought


graceful shouldn't recover memory- it should eat it.  known memory  
leak.  you need to stop, wait for the pid to clear, then start.   
otherwise you just load more and more stuff into memory.



On Aug 23, 2006, at 6:21 PM, Jonathan Tweed wrote:

I looked at lighttpd a few days ago but wasn't overly impressed.  
There seems to be a lot of people with stability issues (as your  
"restart it every day" comment proves) and in my completely  
unscientific tests images seemed to served visibly faster by a fat  
Apache than by lighty which greatly surprised me.


lighty is stable, it just has a memory leak.  its big in distributed  
setups, like 3 processes deep, so people don't often see it.  there  
was a memleak in the bug db for 6mb in one day.  my friend tried it  
on his high-traffic server , just as a reverse proxy, it leaked 60mb  
in a few hours.


most people i know are migrating to nginx, which is way stable, to  
handle reverse proxy.


again though, the benefit isn't in speed so much as it in resource  
allocation.  a single 4mb server dispatching to modperl or vanilla  
apache (possibly serving static),  vs a pool of apache children  
4-10mb each.





Re: Prefork not sharing on FreeBSD, but sharing on OSX ?

2006-08-23 Thread Jonathan

i formatted a spare drive and isntalled ubuntu- then installed my stuff

here are osx , freebsd and ubuntu  (debian )

all numbers are from ps aux , and list  ( in this order )
VSZ RSS


Startup
OSX FreeBSD 
Ubuntu
Parent  80552  3079655148 51736 41252 33420
Child   76560  296  55412 51956 41252 31060



First Request

OSX FreeBSD 
Ubuntu
Child   76560 16960 55412 52070 41384 32340





Re: Prefork not sharing on FreeBSD, but sharing on OSX ?

2006-08-24 Thread Jonathan


On Aug 24, 2006, at 2:59 AM, Philip M. Gollucci wrote:

Every one of those looks as I would expect.


really?  i'd expect the memory usage to be more uniform

RSS is not shared RAM, but memory resident -- the rest in is  
swapped out.

yeah, i didn't finish the gtop tests yet.  i kind of passed out.

they're extremely odd for 2 reasons:

	a- ubuntu's shared memory increased after 1 request.  i tried a few  
different times.  every time i saw an increase in shared, from a few  
k to 5mb

b- freebsd is showing a larger resident than size
c- LARGE difference in what gtop is reporting as shared
ubuntu is showing a size 42mb
30mb shared
12mb per child
freebsd is showing a size of 46mb
8mb shared
38 unshared



Ubuntu

Startup ps
	root  4722  4.3 17.5  41264 33464 ?Ss   04:32   0:04 / 
usr/sbin/apache2 -k start
	www-data  4726  0.0 16.2  41264 31104 ?S04:32   0:00 / 
usr/sbin/apache2 -k start


Request 1 GTOP: (4726)
->size 42389504
->vsize 42389504
->resident 33120256
->share 2961408
->rss 33120256

root  4722  3.0 17.5  41264 33464 ?Ss   04:32   0:04 /usr/ 
sbin/apache2 -k start
www-data  4726  0.1 16.9  41396 32412 ?S04:32   0:00 /usr/ 
sbin/apache2 -k start


Request 2 GTOP: (4726)
->size 42389504
->vsize 42389504
->resident 33189888
->share 2998272
->rss 33189888

root  4722  2.5 17.5  41264 33464 ?Ss   04:32   0:04 /usr/ 
sbin/apache2 -k start
www-data  4726  0.1 16.9  41476 32440 ?S04:32   0:00 /usr/ 
sbin/apache2 -k start



FreeBSD 6

Startup ps
	root 93830 15.8  5.1 54928 51616  ??  Ss4:44AM   0:02.42 / 
usr/local/sbin/httpd
	www  93834  0.0  5.1 54984 51672  ??  S 4:44AM   0:00.01 / 
usr/local/sbin/httpd


Request 1 GTOP: (93834)
->size 46534656
->vsize 46534656
->resident 52944896
->share 8184509
->rss 52944896

root 93830  0.0  5.1 54928 51616  ??  Ss4:44AM   0:02.42 /usr/ 
local/sbin/httpd
www  93834  0.0  5.1 55200 51852  ??  S 4:44AM   0:00.09 /usr/ 
local/sbin/httpd


Request 2 GTOP: (93834)
->size 46727168
->vsize 46727168
->resident 53059584
->share 8184509
->rss 53059584

root 93830  0.0  5.1 54928 51616  ??  Ss4:44AM   0:02.42 /usr/ 
local/sbin/httpd
www  93834  0.0  5.1 55200 51852  ??  S 4:44AM   0:00.11 /usr/ 
local/sbin/httpd




forking/subprocess/etc

2006-09-04 Thread Jonathan

Right now in a modperl app, I have this functionality:

mod-perl request 1:
User requests a contact list to be imported from the internet,
mp logs a 'request' to a database, redirects to status page

python daemon
		continually checks database for import requests, performs import,  
cleans up requests


mod-perl request 2+
checks for import request status, reload every 20s

That  works perfect for most of my stuff...

however, a new function I've just worked out has a rather lengthy  
logic system and series of Regex calls that are already written in Perl.
Its not like a lot of the admin/management stuff in python, and i  
dont feel like converting stuff today


so i need to get this handled within mod_perl somehow, and am a bit  
uneasy on how to handle this


Possible Solutions:
handle import within mod_perl
No.
			Import can take 5-200s, as it requires downloading multiple URLs.   
That blocks apache.

fork() within mod_perl
Probable No.
 			online docs suggest this will fork apache+modperl, which would  
take up too much memory

child processes will persist as zombies when complete

i've got to be missing something

anyone have a clue?  the archives on the list aren't very helpful.



// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -

| FindMeOn.com - The cure for Multiple Web Personality Disorder
| Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -

| RoadSound.com - Tools For Bands, Stuff For Fans
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -





Logging to a file

2006-09-21 Thread Jonathan
I need to introduce some new functionality to my webapp app, and I'm  
not quite sure if i can do it in MP.  Hoping someone here can offer a  
suggestion.


essentially, I have a high traffic syndicated image server that is  
currently serving from a vanilla apache instance.

right now, its not logging anything - but i need to change that.

i not need to log some basic request info ( comparable to what is in  
the access log ) , along with the value of a certain cookie if it  
exists- for later parsing ( faster than tossing into a db )


composing the info i need to log under mp is trivial

i'm a bit uneasy about actually logging to a file though-- it looks  
like under a prefork model ( i need 2+ servers to handle this ), i'd  
need to lock / open / write / close / unlock the log file per request


does anyone know of a facility that will let me just log  
straightforward ?


if not, i can hack this together using a non-apache  server pretty  
quickly.   i'd rather just limit my configuration files though :)


Re: Memory leak in mod_perl?

2006-09-27 Thread Jonathan
IIRC, didn't we track this to Postgresql ?  If so, we should  
relocate to the postgresql lists.


Not officially/definitively, though i've already posted it to the  
pgsql lists.  ( and ruled out bsd as being the cause thanks to some  
friends with NYC BSD UG )




Re: possible memory leaks, FreeBSD,mod_perl/1.29

2006-09-29 Thread Jonathan


That's probably just normal apache growth-- possibly nothing to do  
with modperl


i'd suggest using:
Devel::GC::Helper
and
Devel::Leak

to check refcounts... see what's going on

There's a lot of crazy ways you can have process growth within mod- 
perl that are just perl issues:


	a- there's a slight leak in string evals , its fixed in 5.9, but  
5.8.8 has it
	b- DBI keeps an internal cache of 120 statement handles and  
connection handles.  so you'll see it grow quite a bit, then reset  
later on.  if  you use dbi (or apache::session mysql/postgres/etc ),  
expect it to consume some internal memory for the  cache.


there are more, those are just off the top of my head.

i'd suggest measuring the process size between 1 and 1000 requests.   
often you'll see stuff taper off as perl caches more data or uses  
larger variables.  You can also use sizelimit to force a reset, or  
use maxrequests to spawn a new child in a sweet-spot around  200-750  
requests.





Re: what's the best way to share variables between main script and template files

2006-10-07 Thread Jonathan




On Oct 7, 2006, at 11:12 AM, GZ Dark wrote:

But is it the best way to use global vars for the sharing under  
modperl?is there any other good way?Thanks.


pnotes


personally though, i think you should opt for a more OOP approach and  
create a new header and footer object , explicitly passing in the  
variables you want.




Re: AW: Cannot restart or stop Apache after several days of running

2006-10-17 Thread Jonathan


On Oct 17, 2006, at 2:55 PM, Henrik Steffen wrote:





oops, I didn't know that. I have always done it with
"apachectl restart" until now, and never had any trouble with it.
Note though: apachectl is just a bash script which does a simple
"/usr/sbin/httpd -k restart". Is this still a problem?


no  one does!  its very well documented, but in the worst documented  
place ( not in 1.0/2.0 docs, but elsewhere ).  everyone who has used  
mod_perl finds out about it some time or another.


the problem is in the the restart signal to apache.  it doesn't  
recycle the memory.  you need to do an explicit httpd stop , followed  
by a start



On a different machine e.g. it works fine, without even the
problems restarting after a time.


that 'bug'/behavior seems to affect different os's and mp versions  
differently.  i think someone was trying to fix it and almost did  
once.  (maybe it is done in the newer ones )



Really?? I have never seen something like that. My server has been
running for 42 days now, with maybe 10 "apachectl restarts"
since the last reboot, and the biggest httpd is still only 44 MB.
At the moment only 3.8 GB of the available 4 GB are occupied.
That's pretty normal for this server.


which os?  i might have to switch.



I read this article. And I got some help from it, because the
kill -HUP works fine for me. The module changes are loaded and
I don't need to perform a reboot anymore. That's very good!!

great!

Still, I find it strange, that a usual "httpd -k restart" does not  
work.
the only way to get past it, is to forget thinking about it as  
apache, and think about it as modperl.

you can still restart apache
you just can't restart modperl


When typing "httpd -k start" or "apachectl start": nothing
happening, no logs, no info, nothing.


try tailing /var/log/messages , /var/log/syslog & /var/log/security  
when you do that next


it might be writing an error to something you don't expect.





Re: CSRF (Was: XSS evasion)

2006-10-17 Thread Jonathan

Sorry for the OT ness of this thread---

I spent the better part of the past 2 days trying to do a 1pass  
content filtering on xss attacks-- including flash.  breaking down  
every piece of user input 2x wasn't nice on my server load.


I liked HTML::TagFilter, but it was making broken tags and I couldn't  
push the new tag defaults into it.


So thanks to Clinton Gormley for helping me decide on  
HTML::StripScripts::Parser -- which does facilitate tag defaults--  
albeit in an awkward manner.


Clinton also made a nice skeleton of a wrapper for me to get a  
feeling for, saving me a large bit of the learning curve.


In any event, what follows is code that will rewrite user input of  
'embed' tags for flash and replace in allowScriptAccess='never' and  
allowNetworking='internal' (object tags are not whitelisted for this )


if you let people embed flash onto your site, you will probably want  
to read the code below.


==

use strict;
use warnings;

package Wrapper::StripScriptsParser;
use base 'HTML::StripScripts::Parser';
use HTML::Entities();

sub new {
my $proto = shift;
my $self = $proto->SUPER::new({
Context=> 'Flow',
AllowHref=> 1,
AllowSrc=> 1,
});
$self->attr_encoded(0);
return $self;
}
	#override the context whitelist, and stick embed in there.  we'll  
allow it.

sub init_context_whitelist {
my  ( $self )= @_;
my  $context_whitelist= $self->SUPER::init_context_whitelist() ;
$context_whitelist->{'Flow'}{'embed'}= 'Inline';
$context_whitelist->{'Context'}{'embed'}= 'Inline';
return $context_whitelist;
}
#override the attribute whitelist, and add custom cases for embed tags
sub init_attrib_whitelist {
my  ( $self )= @_;
my  $attrib_whitelist= $self->SUPER::init_attrib_whitelist() ;
$attrib_whitelist->{'embed'}= {
src=> 'href',
type=>'word',
width=>'number',
height=>'number',
flashvars=>'text',
allowscriptaccess=>'allowscriptaccess',
allownetworking=>'allownetworking'
};
return $attrib_whitelist
}
	#override the attribute value whitelist, and add custom classes for  
allowscriptaccess and allownetworking

sub init_attval_whitelist {
my  ( $self )= @_;
my  $attval_whitelist= $self->SUPER::init_attval_whitelist() ;
$attval_whitelist->{'allowscriptaccess'}= 
\&attval_allowscriptaccess;
$attval_whitelist->{'allownetworking'}= 
\&attval_allownetworking;
return $attval_whitelist;
}
#custom attribute value class.  cleans up flash embeds
sub attval_allowscriptaccess {
my ($filter, $tagname, $attrname, $attrval) = @_;
if ( $tagname eq 'embed' ) {
return 'never';
};
return undef;
}
#custom attribute value class.  cleans up flash embeds
sub attval_allownetworking {
my ($filter, $tagname, $attrname, $attrval) = @_;
if ( $tagname eq 'embed' ) {
return 'internal';
};
return undef;
}
sub filter {
my ( $self , $text )= @_;
$self->parse($text);
$self->eof;
return $self->filtered_document;
}
sub reject_start {
$_[0]->output(HTML::Entities::encode($_[1]));
}
sub reject_end {
$_[0]->output(HTML::Entities::encode($_[1]));
}
sub reject_text {
$_[0]->output(HTML::Entities::encode($_[1]));
}
sub reject_declaration {}
sub reject_comment {}
sub reject_process {}
sub __dump__ {
my  ( $self )= @_;
use Data::Dumper();
print STDERR Data::Dumper->Dump( [$self] , [qw(self)] );
}

###

package main;

sub defang_text_ {
my ( $text )= @_;
my  $hss= Wrapper::StripScriptsParser->new();
return $hss->filter($text);
}

my  $kill=  hi
allowNetworking="internal" type="application/x-shockwave-flash"  
src="http://a.com/a.swf";>

A1
allowNetworking="internal" type="application/x-shockwave-flash"  
src="http://a.com/a.swf";>

B
allowNetworking="sameDomain" type="application/x-shockwave-flash"  
src="http://b.com/b.swf"; />

C

D

EOF

print defang_text_( $kill );



###
1;


Re: [QUESTION] How to include content from another site (on the same server)?

2006-10-19 Thread Jonathan

off the top of my head..

a-
	use an ssi or include to the file,  but just use an absolute path,  
or create a synlink so it falls into an easily readable section.  if  
its on the same machine, unless apache is jailed, there's a way to  
get to your data.


b-  
query the blog's cms store directly

c-  
be lazy- just do an iframe to host what you want off the blog




status code / constant question

2006-10-23 Thread Jonathan
I started supporting 400/403 errors in a mod_perl handler for an API  
on my projects


I ran into this odd little issue:

With this line:
	DEBUG_STATUS && print STDERR ("\n status-> " . $r->status() . ' |  
' . Apache2::Const::OK );

I'd expect to see
status-> 200 | 200

Instead, I see
status-> 200 | 0

and this is where it gets more odd...

	if I return $r->status() from the handler ( which is HTTP OK - i  
always check, and i have a 200 ) i see this appended to my documents



OK

The server encountered an internal error or misconfiguration and was  
unable to complete your request.


Please contact the server administrator, [EMAIL PROTECTED] and inform  
them of the time the error occurred, and anything you might have done  
that may have caused the error.


More information about this error may be available in the server  
error log.




if i return NULL /  undef -- i'm fine.


the current workaround, is  for me to do

return ( $r->status() >= 200 && $r->status()<=204 ) ? 0 : $r->status();

which is just stupid.

i must be missing something, or have something configured incredibly  
wrong somewhere.



// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -

| FindMeOn.com - The cure for Multiple Web Personality Disorder
| Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -

| RoadSound.com - Tools For Bands, Stuff For Fans
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -





Re: Transhandler? Redirect permanent?

2006-10-25 Thread Jonathan


On Oct 25, 2006, at 9:48 PM, Will Fould wrote:

I've started testing a handler (configured at '/') that parses $r- 
>uri and checks the object, doing a redirect accordingly, but this  
seems wasteful for every hit.

I've thought about using the handler for only 404...



Personally, i use a dispatch table and dispatch regex system --  
sample organization code below


i see if a stripped uri is in the dispatch, if its not i loop/recurse  
regex trees looking for  matches/better matches


if i get nothing, then i go 404

the static and regex lookups are negligible.   i think they're like  
1/5 seconds, or soemthing ridiculously fast like that on my  
slowest box




use constant URL_Dispatch=> {
'/'=> 'FindMeOn::Syndicate::Base::Default',
'_default'=> 'FindMeOn::Syndicate::Base::Default',
'/findmeon/visit/'=> 'FindMeOn::Syndicate::Base::Findmeon::Visit',
};

use constant URL_RegexDispatch=> [
{
regex=> qr/^\/findmeon\//,
sections=> [
# findmeon-embeds , links
{
'regex' => 
qr/^\/findmeon\/findmeons\/([\w]{32})\/v1(:?\/)?$/,
'package'   => 
'FindMeOn::Syndicate::Base::Findmeon::Findmeons::v1',
'id_fields'=> ['hex_id']
},
}
];

// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -

| FindMeOn.com - The cure for Multiple Web Personality Disorder
| Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -

| RoadSound.com - Tools For Bands, Stuff For Fans
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -





Re: looking for recommendations for a perl user account script

2006-11-02 Thread Jonathan


On Nov 1, 2006, at 11:32 AM, Neville Aga wrote:

Hello, I have a existing website which I am looking to add in a  
piece for users to sign up for accounts. I am searching around  
Google and I find a few scripts mentioned - account manager /  
account manager lite from site interactive (last update 2001), a  
package called burp Basic User Registration Package, which seems to  
be dead links now, and Membership manager pro from perlwebsite.com.  
Does anyone have any experice or recommendations on these or any  
other (perl) scripts that automate the process of signup, approval  
(ideally credit card approval with authorize.net), email out lost  
passwords, etc?


What I am hoping for is a form based login which sets a cookie on  
the users browser. When the user clicks the signup button, there  
would be a form to enter an email, password and credit card info.  
If the credit card goes through then the account is created.  I  
don't want to go out and re-invent this if good scripts already  
exist. Hopefully this is not too off topic and someone reading this  
has experice with these scripts or other scripts and can give me a  
suggestion where to look.



This is a mod_perl list, not perl

You'd get a lot better answers asking (or searching) on http:// 
perlmonks.org -- they deal with generalized perl questions.




Re: retrieving cached connections

2006-11-29 Thread Jonathan


On Nov 29, 2006, at 2:46 PM, Philip M. Gollucci wrote:


Michael Peters wrote:

+# we can only do our magic if DBI isn't already loaded
+warn "Apache::DBI must be loaded after DBI to work correctly";

I like it -- any objects list ?


i REALLY like that idea.

it solves the problem AND teaches people how to do things the right way.

+1


// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -

| FindMeOn.com - The cure for Multiple Web Personality Disorder
| Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -

| RoadSound.com - Tools For Bands, Stuff For Fans
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -





Re: Apache2::Status "Memory Usage" fails on Debian

2006-11-30 Thread Jonathan


On Nov 30, 2006, at 5:58 PM, David Scott wrote:

This is not a good Apache day.  I already sent out a message  
regarding an Apache::Scoreboard problem, and now Apache2::Status  
doesn't work either.


it's a bug, but i think its platform specific/ odd

i ran into the same thing a while back

check out this:

http://comments.gmane.org/gmane.comp.apache.mod-perl/24906

i have 2 posts at the bottom, which i'll just paste here:

=
Jonathan | 13 Aug 00:46

I'm finding some issues with the 2 modules

i think some of it happens when you have a module that has no
subroutines ( ie , a namespace placeholder or something )

check out ~ line 551 in Apache2::Status

adding a few over-the-top checks seems to help, and gets memory use
working on more items

 } (sort { $subs->{$b}->{size} <=> $subs->{$a}->{size} } keys %
$subs);

+   return if ! scalar   keys;
+   return if ! defined $subs->{$keys[0]};
+   return if ! defined $subs->{$keys[0]}->{count};
+   return if ! defined $subs->{$keys[0]}->{size};

 my $clen = length $subs->{$keys[0]}->{count};
 my $slen = length $subs->{$keys[0]}->{size};

i'll have more fixes as time progresses

==

Jonathan | 13 Aug 00:56

ok, also found

I also figured this out:

in B::TerseSize, line 634

- my $script = $q->script_name;

+ my$script ;
+ if ( defined $q && $q )
+ {
+   $script = $q->script_name;
+ }

Killing that makes a lot more things work too.

The only caveat of that, is that 'memory usage' doesn't appear on /
perl-status/ until you visit a symdump page that contains memory-
usage.  i don't know why.  but that should only happen on situations
already afflicted by the other bug.  so its a stupid new bug instead
of a bad old one.

==



// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -

| FindMeOn.com - The cure for Multiple Web Personality Disorder
| Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -

| RoadSound.com - Tools For Bands, Stuff For Fans
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -





Re: using light/heavy apache

2006-12-01 Thread Jonathan


On Dec 1, 2006, at 2:20 PM, Frank Wiles wrote:


   You might want to look at PerlBal (http://www.danga.com/perlbal/)
   also to use in place of a light Apache.  It's lighter then a light
   Apache and has some other interesting features.


pesonally, i'm a huge fan of nginx ( http://wiki.codemongers.com )
using it, i've really gotten a lot more out of my mod_perl servers.

// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -

| FindMeOn.com - The cure for Multiple Web Personality Disorder
| Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -

| RoadSound.com - Tools For Bands, Stuff For Fans
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -





Re: light+ssl/heavy and conf management

2006-12-04 Thread Jonathan


On Dec 4, 2006, at 1:50 PM, Michael Peters wrote:


Adam Prime x443 wrote:


I'm in the process of moving about a half a dozen domains to a
light/heavy setup with SSL being done on the light server and  
proxied to

the backend on localhost.  I've been trying to find a good way to
minimize the potential to have inconsistencies in the  
configuration of
the front, SSL, and backend servers, and it seems like the most  
obvious

way to do that would be to use a single configuration file, using
IfDefine's to specify what's supposed to be for who.


We actually take a different approach for this. We used a templated  
configs
(HTML::Template, but Template Toolkit would work just fine too). We  
have a
single source for the data (in our case another config file, but  
you could
easily just use a DB) and 2 separate configs for the proxy and  
application server.


The configurations between the 2 would be very different (SSL, IP  
addresses,
Keep-Alive settings, mod_perl, etc) that it's just easy to keep  
them separate.
Sometimes we use the same binary for each, just with different  
configs.



In my setup  i don't use apache for light, i use nginx, but its kind  
of  similar - as I use Adam's approach to standardize FreeBSD/Ubuntu/ 
OSX production and dev boxes, and run 3 different mod_perl servers on  
the same box:


1- I created a custom apachectl and added an IfDefine for each os.   
if you run on different os's, you need to do it as each system tends  
to have 1 or 2 lines that are platform specific regarding memory of  
file locking or something.


2- all my vhosts are stripped out of the main file and put into a  
virtual_hosts directory

i keep all this stuff in subversion along with the application
	for sanity sake, i hardcode all of the config files to be placed   
in  "/usr/apache_custom/appname" , then just symlink the app  
directory to that spot

/usr/apache_custom/appname/conf
httpd.conf
virtual_hosts.dev
virtual_hosts.production

	an ifDefine directives regarding a dev/production flag ( or in your  
case front/back ) specifies  which directory to include



now, that said... your system is crazy.  its going to be a nightmare  
to maintain.


since you've got a light/heavy  setup, i think you REALLY REALLY  
REALLY should be not only be using two seperate httpd.conf files ,   
but also treating both servers as completely independant with their  
own apachectls


i strongly suggest having
/usr/apache_custom/appname/sbin
customized apachectl - points to the pid + conf files
/usr/apache_custom/appname/var
customized pid and logs ?

why?
	design wise, you've got 2  completely different services going on.
the light /ssl is a port 80 service.  the other one is a port X  
service.  they're inter-related in this application, but you might   
have other services that port80 needs to forward to at a different  
point.


	also, you're going to need to ifDefine the modules too. don't run  
modperl but run ssl and proxy if we're the light server, do the  
inverse if we're not.


	it'll also simplify things for when you need to support some sort of  
'downtime' message ( ie , restart either port 80 or modperl using a  
different configuration file when you need to do server maintenance )


then to start/stop stuff its just

/usr/apache-custom/modperl_findmeon/sbin/apachectl -D  
ApacheServerFreeBSD -k stop
/usr/apache-custom/modperl_findmeon/sbin/apachectl -D  
ApacheServerFreeBSD -D DownTime -k start
/usr/apache-custom/modperl_findmeon/sbin/apachectl -D  
ApacheServerFreeBSD -D DownTime -k stop
/usr/apache-custom/modperl_findmeon/sbin/apachectl -D  
ApacheServerFreeBSD -k stop


looks like a lot of text... but you can just make shell scripts.
( actually, i remember that in that example i have a sep. production  
and dev configuration tree, and just mount the appropriate one on / 
usr/apache-custom )  in any event,  it took 30 minutes to migrate my  
system to this setup, and i now can manage all of my dev and  
production machines with no issues.


// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -

| FindMeOn.com - The cure for Multiple Web Personality Disorder
| Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -

| RoadSound.com - Tools For Bands, Stuff For Fans
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -





Re: [BUG] Inconsistent $r->print() behavior with references

2003-12-10 Thread Jonathan Field
Thanks, all, for the prompt attention.  I will update my coding habits
accordingly :)

Cheers

On Wed, 10 Dec 2003, Stas Bekman wrote:

> I've pinged Doug and the final verdict is this:
>
>The print-a-scalar-reference feature is now deprecated. There are
>known bugs when using it and it's not supported by mod_perl 2.0. If
>you have a scalar reference containing a string to be printed,
>dereference it before sending it to print.
>
> It's now documented as such.
>
> Jonathan, please adjust your code to dereference the scalar references before
> sending them to print.
>
> __
> Stas BekmanJAm_pH --> Just Another mod_perl Hacker
> http://stason.org/ mod_perl Guide ---> http://perl.apache.org
> mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org   http://ticketmaster.com
>


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



Registry not loaded...script still works

2004-02-09 Thread Jonathan Mangin
I have a static installation of mod_perl-1.29 with apache-1.3.29.
Apache::Registry lines are commented in httpd.conf and startup.pl.
Apache::Status shows that ::Registry is not loaded.
Why does my script still work??


PerlRequire /usr/local/apache/perl/lib/startup.pl
# PerlFreshRestart On
PerlTaintCheck On

Alias /perl-bin/ /usr/local/apache/perl-bin/

# PerlModule Apache::Registry
# PerlModule Apache::DB


#   PerlFixupHandler Apache::DB
   SetHandler perl-script
   PerlHandler Apache::Registry
   Options ExecCGI
#   PerlSendHeader On
   Allow from all




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



Re: Registry not loaded...script still works

2004-02-09 Thread Jonathan Mangin
 
> It can work as a CGI script without Apache::Registry.  If you want to
> be sure what's going on, put some debugging statements in the code so
> that they will tell you what is being ewxecuted (and, by a process of
> deduction, what isn't).
> 

Well, silly me. :)  I expect (and prefer) directives in a configuration
file to be absolute, and hope for something to break when I try to 
break it. ;)  Thanks, though.

> 73,
> Ged.
> 
> PS: your ISP seems to be telling me that your mailbox is disabled.
> 
I had trouble posting to this list (only) another time. Here's part
of what bounced back this time...

   could not be gateway to this address

   For more information about this gateway send a mail to
   Alexander Uskov 2:5083/121 or [EMAIL PROTECTED]

Any clues about this guy in Kazoo(?:) and why a transaction between
an ISP in Indianapolis, Indiana USA and perl.apache.org cares?



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



Re: Mail bounced thru Kazakhstan -- This list only

2004-02-09 Thread Jonathan Mangin
Doh. Tell me it's not me and I'll quit uglying up your inbox.

--Jon


- Original Message - 
From: "Dooley, Michael" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, February 09, 2004 5:02 PM
Subject: RE: Mail bounced thru Kazakhstan -- This list only


> its not a problem with the list. it's a problem w/ one of the users on the
> list.
>


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



PerlEnable directive suggestion

2004-09-25 Thread Jonathan Sailor
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi,
I've got a suggestion for a new directive for mod_perl (1, preferably, 
because I use it):

PerlEnable on|off
Context: everywhere but .htaccess
Basically, it could be used to completely disable mod_perl. It would be 
most useful (for me) in UserDirs, with something like:


PerlEnable off

to prevent users from using .htaccess files to install their 
PerlHandlers and running code inside Apache's webspace.

- -Jonathan Sailor
_
"Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect." -Linus Torvalds
_
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (GNU/Linux)
iEYEARECAAYFAkFUy7EACgkQawvJL8S14J/dDQCePfS3IPnwoJO/QyRy6DlL1dKO
UQ4An1UFgqLhO0U3qn7Q0uKJP3oav97L
=d6uY
-END PGP SIGNATURE-
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


New to ModPerl 2

2004-11-14 Thread jonathan vanasco
I'm new to using mod_perl2
A few years ago I made a web application in perl cgi, moved it over to 
mod_perl1 about a year ago, and now I want to continue development of 
it in mod_perl2

I probably made this wrong to begin with, as I learned from a handful 
of mod_perl books

In mod_perl1, I have a handler that takes an apache request object 
manipulates the cookie/session data into a user, then presents the user 
with a page

in mod_perl2, however, there is no Apache::Request (yet) -- so my code 
simply doesn't work at all.  For some reason I'm not getting any decent 
error messages in the log, but playing with the code I've found one of 
the first issues to be with the cookies (i was using Apache::Cookie, 
which no longer exists), so i've stripped that out to continue testing, 
but keep on hitting walls of errors that aren't logged in the error 
log.

I've tried installing the development branch of libapr , but that 
hasn't been going well on my dev machine (mac osx)

If anyone can enlighten me to some better overall approaches to 
code/cookies, and might have something to suggest based on my poorly 
worded problem descriptions above, i would be greatly appreciative.

Thanks!
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: New to ModPerl 2

2004-11-14 Thread jonathan vanasco
On Nov 14, 2004, at 4:06 PM, Kurt Hansen wrote:
Markus Wichitill wrote:
Apache::Request 2.0 (libapreq2), like mod_perl 2.0, is officially 
still in development, but mostly done.

http://httpd.apache.org/apreq/
I second the advice to use libapreq2 if your code is based on 
libapreq1. I'm almost done with the conversion.
Thanks to both then!
I was under the impression that it is 'more correct' to not use the 
request object in mod_perl2 and instead approach the application 
development differently.

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: New to ModPerl 2

2004-11-14 Thread jonathan vanasco
On Nov 14, 2004, at 7:04 PM, Dan Brian wrote:
I'll add to your list (of potential confusion) that $r->args may not  
produce the expected results, and not just because of the change away  
from array context described at:

   


Although Apache::Request inherits methods from Apache::RequestRec,  
args() is one place where there is function overlap:  
Apache::Request->args() returns an Apache::Request::Table object,  
while Apache::RequestRec->args() returns the unparsed query string.
Gee...  Thanks...
This is a lot to digest.
I think I may have extended use of deprecated features, and I'm not  
averse to refactoring the code

Apache::Compat, apparently is slow
CGI.pm, if i remember, was awkward and also slow
ugh
I think i need a drink
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: New to ModPerl 2

2004-11-15 Thread jonathan vanasco
Assuming this is a segfault, i get the same error:
[Tue Nov 16 00:45:17 2004] [notice] child pid 2237 exit signal Bus 
error (10)

The only difference is the env variable to ApacheCookie
This works:
==
#file:MyApache/Rocks.pm
#--
package MyApache::Rocks;
#use strict;
#use warnings;
use Apache2;
use Apache2::mod_perl();
use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::Request ();
use Apache::Cookie();
use Apache::Const -compile => qw(OK);
sub handler
{
my  $r  = shift;
my  $req= Apache::Request->new( $r , DISABLE_UPLOADS=>1);
my %cookiejar = Apache::Cookie::Jar->new( $r );
$r->content_type('text/plain');
print "mod_perl 2.0 rocks!\n";
return Apache::OK;
}
1;
==
This does not
==
#file:MyApache/Rocks.pm
#--
package MyApache::Rocks;
#use strict;
#use warnings;
use Apache2;
use Apache2::mod_perl();
use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::Request ();
use Apache::Cookie();
use Apache::Const -compile => qw(OK);
sub handler
{
my  $r  = shift;
my  $req= Apache::Request->new( $r , DISABLE_UPLOADS=>1);
my %cookiejar = Apache::Cookie::Jar->new( $req );
$r->content_type('text/plain');
print "mod_perl 2.0 rocks!\n";
return Apache::OK;
}
1;
On Nov 15, 2004, at 11:18 AM, Joe Schaefer wrote:
Kurt Hansen <[EMAIL PROTECTED]> writes:
[...]
A few things that caused me more pain than I care to admit:
1. Apache::Cookie v2 requires an Apache::RequestRec environment
variable instead of an Apache::Request variable. Using the latter
caused a segmentation fault.
If so, that's really a bug, not a portability issue.  Apache::Request
objects are derived from Apache::RequestRec, so it should be ok to pass
them to any Apache::Cookie methods which expect an Apache::RequestRec
object.
Can you please show us the code which segfaults?

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Segfaults with mod_php + mod_perl + mysql + mysqli

2004-11-16 Thread jonathan vanasco
On Nov 16, 2004, at 3:58 AM, Sönke Ruempler wrote:
Hi,
I asked the php-install and php-dev lists before - they didn't answer.
I dunno if it's PHP and/or Perl related - so before I open a PHP Bug 
Report,
maybe here someone has an idea:

<<
Hi,
Because I upgraded my MySQL server to 4.1.7, I tried to compile my 
mod_php
with mysql + mysqli support. After some problems with double 
"-lmysqlclient"
in Makefile (found solution in bugs.php.net), the new mod_php 
compiled. But
after testing it with Apache, The webserver had segfaults and mod_perl 
error
messages:

I think there is a conflict between the mysql extensions of PHP and 
Perl.

Here is the Software:
Linux 2.6.8.1 #1 SMP Mon Sep 20 13:59:23 CEST 2004 i686 i686 i386 
GNU/Linux
Apache  2.0.52
Perl 5.8.3
mod_perl 1.99
PHP 5.0.2
MySQL 4.1.7 libraries RPM from mysql.com

Any Ideas?
Yep.  You're right.  I've run into this a few times.
If I remember right, its a problem stemming from library collisions -- 
and there should be a bunch of info on google somwhere.

I don't remember what i did to get things to work, but a quick google 
search just suggested that it might work  if you compile php without 
mysql built in -- I dont believe php needs the mysql stuff compiled in 
to use it, its just a speed issue.

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: New to ModPerl 2

2004-11-16 Thread Jonathan Vanasco
I'm just  wondering how people have handled cookie stuff before --
There seems to be a group that has encountered this error, and another 
group that has not -- if anyone is a member of the latter group and can 
share their approach to cookie/request handling (assuming its more than 
just substituting a ($r = shift;) with a ($req 
=Apache::Request->new($r)) i'd love to see it

On Nov 16, 2004, at 8:31 AM, Joe Schaefer wrote:
OK, thanks!  This bug should be fixed with
the next release.  It's a bit tricky to
fix this, because Apache::Request doesn't
always inherit from the environment object.

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Advice needed on custom webapp framework

2004-11-17 Thread jonathan vanasco
I built for mod_perl1 a customer webapp framework
It functions as 2 perl modules/package sets
/lib/WebAppFramework
/lib/Website
For each website/webapp, i make a new /lib/Website that subclasses the 
WebAppFramework (which handles users, email, webpage generation, etc -- 
and makes heavy use of cpan modules -- i just wanted a way to find a 
lowest-common-denominator to interface with multiple packages, so i can 
rapidly prototype webapps)

It worked really well for everything I want it to do -- super simple 
and easy to build and add functions.

except - its a little messy
The idea I wanted to implement, is essentially this handler:
my  $DB = new Website::DB();
sub handler {
	DEBUG >0 && print STDERR " NEW 
REQUEST\n\n";
	my 	$r 		= shift;
	my 	$user 	= new Website::User( \$r, \$DB );
 	my 	$page 	= new Website::Page( \$user , \$DB );
	my 	$html 	= $page->processRequest();
	$r->content_type('text/html');
	$r->print( $html );
	return OK;
}

The idea, is that any page is just a view to a user (logged in or not), 
so is rendered to that person.

Now, this is my issue -- I'm creating a user AND a page with a ref to 
the DB handle - which is wasteful. And requires a lot of extra typing 
on my part.

Ideally, I would have the packages  in Website and WebAppFramework 
lookup the right DB for the Website

I can't figure out how to do this in a coherent way though.
Any  advice would be excellent.
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Advice needed on custom webapp framework

2004-11-17 Thread Jonathan Vanasco
Thanks!
Right now, I should have been more clear, though -- I'm am kinda doing 
a bit of each approach you mentioned -- but i am in need of a little 
more help.

I think what i want is more of your second approach right now...
 Let me elaborate for a moment
WebAppFramework::DB.pm
Base Class
Users Apache:DBI
Package handles all DB abstraction and connections
Website1::DB.pm
SubClass of WebAppFramework::DBI.pm
Package has configuration information (host/port/user/pass/etc)
Website2::DB.pm
	SubClass of WebAppFramework::DBI.pm
	Package has configuration information (host/port/user/pass/etc)
	Website1/Website2 are different package directories that subclass the 
framework
	I'm showing Website1/Website2 just to illustrate the namespace

In the example on my last post, my handle does this:
package Website1;
my  $DB = new Website1::DB();
# make a new ref for the website
sub handler
{
my  $r  = shift;
my  $user   = new Website::User( \$r, \$DB );
my  $page   = new Website::Page( \$user , \$DB );
my  $html   = $page->processRequest();
}
what i would like is:
sub handler
{
my  $r  = shift;
my  $user   = new Website::User( \$r );
my  $page   = new Website::Page( \$user );
my  $html   = $page->processRequest();
}
now, i guess what i'm trying to do within
	Website1::User
	Website1::Page
is access the
	$DB in the base of Website1 that i define just before the handler
BUT
	I'm trying to do so in a way that both:
		Website1::PackageName
		Website2::PackageName
		WebAppFramework::PackageName
	Will all retreive the correct DB from the script that defines the 
handler

I've tried this a few different ways, but I've often ended up reading  
WebAppFramework::$DB instead of Website1::$DB
I guess I'm trying to figure out a way for the baseclasses to access 
information in the subclasses - which sounds wrong, stupid and 
impossible.

Does that make more sense?  Does your suggestion still apply?
Sorry, I'm just very confused by all this myself, and I fear that i'm 
not asking the right questions.


On Nov 17, 2004, at 12:11 PM, Michael Schout wrote:
There are many ways to solve this problem.  I'll show you 2 ways.  I'll
focus just on the database part to keep this as short as possible, but
the same ideas apply to the user object...

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Advice needed on custom webapp framework

2004-11-17 Thread Jonathan Vanasco
Because i'm an idiot and didn't realize that I was doing that!
I'm just used to passing refs everywhere.  to get into the whole 'No 
More passing large vars around' thing, i just stopped passing 
everything but a ref

Silly me!
On Nov 17, 2004, at 1:25 PM, Tom Schindl wrote:
I don't answer your questions but why are you passing all objects by 
reference. An object is already a reference (normally Hash or Scalar)
and it does not improve your memory usage it only decreases your 
performance because you always have to dereference it.

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Advice needed on custom webapp framework

2004-11-17 Thread Jonathan Vanasco
I'm pretty damn sure you did get that right!
That would do EXACTLY what i want it to do!
I'm gonna play around with that approach when i get home tonight.  
Thanks!

On Nov 17, 2004, at 2:26 PM, Tom Schindl wrote:
What you really need here when talking about Pattern-Programming is a 
"Factory-Class" which creates the
appropiate WebAppFramework::DBI-Sub-Class for you and design all your 
Website*::DBI-classes as "Singletons".

Hope I got you right? If you don't want to use config values you could 
also use the name of the package
in the handler e.g. Website1, Website2 and add "::DBI" in your factory 
method.

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Urgent justification for perl

2004-11-19 Thread Jonathan Vanasco
Justification using perl/mod_perl for what, and opposed to what?
A security risk in what way?
There's a 'Success Stories' page here, that might have some things you 
want/need:
http://perl.apache.org/outstanding/index.html



On Nov 19, 2004, at 7:35 AM, Martin Moss wrote:
All,
I've had an urgent request for a few paragraphs on the
justification for the use of perl. In particularly
mod_perl.
Someone in the powers that be read an outdated
description and thinks that using perl is a security
risk - (I know, its not what you use, but how you use
it thats the security concern).
Any ideas?
Marty
		
___
Moving house? Beach bar in Thailand? New Wardrobe? Win £10k with 
Yahoo! Mail to make your dream a reality.
Get Yahoo! Mail www.yahoo.co.uk/10k

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Urgent justification for perl

2004-11-19 Thread Jonathan Vanasco
I think you're getting mod_perl confused with mod girls.  They wear 
white boots, and pose in magazines.

On Nov 19, 2004, at 2:17 PM, [EMAIL PROTECTED] wrote:
3) it seem's sexy
one of those is a 'valid reason' above all others, see if
you can tell which one ;>
regards
Steph

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: mod_perlservice? what the heck?

2004-11-24 Thread Jonathan Vanasco
It makes a lot of sense to me
Having spent time building lots of webapps with flash, and knowing many 
people who still do so and come from art school backgrounds, their 
system seems simple enough and tailored exactly for someone who doesn't 
know programming

It seems to be an easily configurable  and targeted (not limited) 
system for completing an often needed task.

mod_perl would be more flexible, and php might make more sense, but 
their syntax and instructions seem pretty much on key for the audience 
that would use it

On Nov 24, 2004, at 1:40 PM, Frank Wiles wrote:
  But I agree, this looks like re-inventing the wheel, road, and the
  whole concept of movement simply because you had the time to spare!

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: mod_perl marketing

2004-11-30 Thread Jonathan Vanasco
Amazon itself might be mason under fastcgi, but its imdb.com subsidiary  
seems to be mod_perl by the job descriptions here

 (there was a 'love movies? know perl?' job link in big letters on the  
imbd front page when i looked up a movie today)

http://www.amazon.com/exec/obidos/tg/stores/static/-/jobs/department/ 
Seattle-Headquarters/006/002-2593704-5384848

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: mod_perl marketing

2004-11-30 Thread Jonathan Vanasco
People want benchmarks.  Little graphs that show "Speed", and why it 
matters to them

C is going to be faster for certain things, Perl for others.  Thats a 
given.
But over half of the speed optimizations one language has over another 
are useless in any given application.
If you give raw numbers, people apply them to the interpretations they 
already have.

People need to be told something is better than another -- for THEIR 
use.

An old argument for writing stuff in python vs java or c, is saying 
that python executes almost as fast, but is written much quicker -- so 
you tradeoff a negligible amount of runtime for a large amount of 
development work.

Thats a compelling argument to get people to use it.
I wouldn't know where to begin, but I'd suggest the following:
Spec out a small little project/exercise - for example
	a -	a webapp that allows users to register accounts in dbm or mysql, 
allows them to log in, and post a message on a whiteboard
	b - 	some sort of request processing -- url rewriting or something 
like that
Time the perl code and c code development
Note the lines of code each required (with and without standard libs)
Run them
	a - which one has less resources on the system
	b - which one executes faster
	c - which one handles more concurrent users

Then show why mod_perl is better based on those results.

On Nov 30, 2004, at 2:47 PM, Clayton Cottingham wrote:
What I am saying , is if you want to open up the mod_perl market you 
have to
look at why people are not moving to mod_perl

This is a valid reason for not coming over to the mod_perl ranks, 
because
some people don't see mod_perl as being faster/better than c apps

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Apache::Session permissions problem

2003-11-13 Thread Jonathan Swartz
Perrin Harkins writes:

> Sorry if I came off overly critical.  Many people have had problems
> trying to use Mason with Apache::Session because of that article.  This
> is why on the Mason website the link to that article describes it as
> outdated and steers people to newer documentation.  (It probably should
> also steer them to the new handler...)

I've deactivated the link and pointed to the new handler.

> By using Apache::Session::Flex.  The configuration for
> MasonX::Request::WithApacheSession also lets you do this.

I was planning to use Flex too. But I came upon an email from Jeff

  http://marc.theaimsgroup.com/?l=apache-modperl&m=100283817811419&w=2

saying "Regarding Flex, nobody uses it.  It is for debugging.  If you have a
particular variant of Flex that you use all the time (very likely), you
can code up a 6-line module to make a real implementation like all the other
session modules. Flex is for debugging, period."

Is this outdated information? Is Flex now considered reasonable for
production? (Not sure why it "for debugging" in the first place.) Is there
any disadvantage to using it versus creating a custom session class?

> In my opinion, the locking approach taken in Apache::Session is not a good
one for
> the average web site and you should simply turn it off by using the
NullLocker.

Yes, we're about to add a note to MasonX::Request::WithApacheHandler
indicating as much.

I have heard so many complaints about MySQL locking, and have encountered
problems with it myself, that I have to wonder why it is still in the
package at all (much less the default)? Is there any real way to use it
successfully? If I can get it to fail out of the box with my two development
server processes and a few hits an hour, how could it ever be trusted in
production?

> The latest Apache::Session on CPAN is version 1.54, released in October
2001.

Perhaps this answers my previous question. :)

Jon


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



Re: Apache::Session permissions problem

2003-11-13 Thread Jonathan Swartz

> > > The latest Apache::Session on CPAN is version 1.54, released in
October
> > 2001.
> >
> > Perhaps this answers my previous question. :)
>
> Yes, it is far from actively maintained.  I've been considering
> recommending that people use CGI::Session instead, since it is better
> documented and better maintained.

Interesting! I'll take a look. Have you seen any comparisons of features
anywhere?


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



Re: Apache::Session permissions problem

2003-11-13 Thread Jonathan Swartz
> On Thu, 2003-11-13 at 15:18, Jonathan Swartz wrote:
> > Interesting! I'll take a look. Have you seen any comparisons of features
> > anywhere?
>
> No, I don't think anyone has written up a comparison.

Well, at first glance it looks promising - lots of documentation and
examples, last release pretty recent - but then I took a look in
Apache::Session::MySQL and saw:

   # stores the serialized data. Returns 1 for sucess, undef otherwise
   sub store {
   my ($self, $sid, $options, $data) = @_;

   my $dbh = $self->MySQL_dbh($options);
   my $lck_status = $dbh->selectrow_array(qq|SELECT GET_LOCK("$sid",
10)|);
   unless ( $lck_status == 1 ) {
 $self->error("Couldn't acquire lock on id '$sid'. Lock status:
$lck_status");
 return undef;
   }
   ...
   return $dbh->selectrow_array(qq|SELECT RELEASE_LOCK("$sid")|);
   }

So the default MySQL driver does locking just like Apache::Session, and
there's no built-in way to turn it locking. So it's possible that the same
locking problems that plague Apache::Session would happen in CGI::Session.
Argh!

Jon


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



Re: Apache::Session permissions problem

2003-11-13 Thread Jonathan Swartz
> On Thu, 2003-11-13 at 16:47, Jonathan Swartz wrote:
> > So the default MySQL driver does locking just like Apache::Session, and
> > there's no built-in way to turn it locking. So it's possible that the
same
> > locking problems that plague Apache::Session would happen in
CGI::Session.
> > Argh!
>
> So, basically you are left with using Apache::Session::Flex and its
> NullLocker class or making your own session module.  You could also
> create a separate CGI::Session driver that doesn't have the locking in
> it.

Sure, either of these things are easy to do once you know about them. My
particular goal is finding a standard session mechanism for the Mason user
community that's functional out of the box, well supported, and minimally
confusing. Dave's MasonX::Request::WithApacheSession does go a long way
towards this goal, but you still have to know about the various
Apache::Session pitfalls.

For now, I guess we focus on improving our documentation to help users avoid
as many of these pitfalls as possible.

Jon


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



Unable to install mod_perl using several tutorials...

2003-11-26 Thread Jonathan Villa
Ok, I'm trying to install OpenWebMail but I keep getting an Internal 
Server Error when I try to access it via the web.

Here is what I have/did

Installed: Apache 1.3.29/mod_ssl 2.8.16-1.3.29/PHP 4.3.4
Installed: v5.8.2 built for i686-linux
I'm trying to install mod_perl 1.29 and I've followed several tutorials, 
many of which compile apache with mod_perl and seem to mess up my httpd 
configuration.  So, what I'm trying to do is to get mod_perl working but 
without having to recompile Apache.  Perhaps I already have it installed 
since this is in my httpd.conf file

LoadModule perl_modulelibexec/libperl.so
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

AllowOverride None
Options None
Order allow,deny
Allow from all

and libperl.so is indeed in the libexec dir.

Anyway, perl seems to be working because I tried ./openwebmail-tool.pl 
and it works, and if I do a perl -V I get information.

So, I tried this:

I created a file, index.pl, inside of /var/www/cgi-bin and all it has is

#!/usr/bin/perl
print "does this work\n";
via command line

$perl index.pl
does this work
but via the web, I get an Internal Server Error
and in the error_log
Premature end of script headers: /var/www/cgi-bin/index.pl



I'm very perplexed

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


Re: Unable to install mod_perl using several tutorials...

2003-11-26 Thread Jonathan Villa
I did the Content-Type and nothing new...

So you're saying that Openwebmail does not require mod_perl?  This is 
the main thing I need to get setup...so perhaps I should look into the 
openwebmail forum for a solution?

The only thing that confuses me is how does a web based program work 
without mod_perl?

And how can I get the simple index.pl file to work, I think I would feel 
more comfortable once that is working...

tvilliers wrote:

On Wed, 26 Nov 2003 09:36:39 -0600, Jonathan Villa wrote:


Ok, I'm trying to install OpenWebMail but I keep getting an Internal
Server Error when I try to access it via the web.
Here is what I have/did

Installed: Apache 1.3.29/mod_ssl 2.8.16-1.3.29/PHP 4.3.4 Installed: v5.8.2
built for i686-linux
I'm trying to install mod_perl 1.29 and I've followed several tutorials,
many of which compile apache with mod_perl and seem to mess up my httpd
configuration.  So, what I'm trying to do is to get mod_perl working but
without having to recompile Apache.  Perhaps I already have it installed
since this is in my httpd.conf file
LoadModule perl_modulelibexec/libperl.so ScriptAlias /cgi-bin/
"/var/www/cgi-bin/" 
AllowOverride None
Options None
Order allow,deny
Allow from all

and libperl.so is indeed in the libexec dir.

Anyway, perl seems to be working because I tried ./openwebmail-tool.pl and
it works, and if I do a perl -V I get information.
So, I tried this:

I created a file, index.pl, inside of /var/www/cgi-bin and all it has is

#!/usr/bin/perl
print "does this work\n";
via command line

$perl index.pl
does this work
but via the web, I get an Internal Server Error and in the error_log

Premature end of script headers: /var/www/cgi-bin/index.pl




print "Content-type:text/html\n\n"

before anything else to avoid this error


I'm very perplexed


Openwebmail does not require a mod_perl httpd, but the latest version (6
weeks ago) does require a suidperl. The initial setup can be a bit
daunting, but it's well worth it.





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


Re: Unable to install mod_perl using several tutorials...

2003-11-26 Thread Jonathan Villa
I even tried a simple index.html within the /var/www/cgi-bin dir...

FYI, I do have suidperl installed

Jonathan Villa wrote:

I did the Content-Type and nothing new...

So you're saying that Openwebmail does not require mod_perl?  This is 
the main thing I need to get setup...so perhaps I should look into the 
openwebmail forum for a solution?

The only thing that confuses me is how does a web based program work 
without mod_perl?

And how can I get the simple index.pl file to work, I think I would feel 
more comfortable once that is working...

tvilliers wrote:

On Wed, 26 Nov 2003 09:36:39 -0600, Jonathan Villa wrote:


Ok, I'm trying to install OpenWebMail but I keep getting an Internal
Server Error when I try to access it via the web.
Here is what I have/did

Installed: Apache 1.3.29/mod_ssl 2.8.16-1.3.29/PHP 4.3.4 Installed: 
v5.8.2
built for i686-linux

I'm trying to install mod_perl 1.29 and I've followed several tutorials,
many of which compile apache with mod_perl and seem to mess up my httpd
configuration.  So, what I'm trying to do is to get mod_perl working but
without having to recompile Apache.  Perhaps I already have it installed
since this is in my httpd.conf file
LoadModule perl_modulelibexec/libperl.so ScriptAlias /cgi-bin/
"/var/www/cgi-bin/" 
AllowOverride None
Options None
Order allow,deny
Allow from all

and libperl.so is indeed in the libexec dir.

Anyway, perl seems to be working because I tried 
./openwebmail-tool.pl and
it works, and if I do a perl -V I get information.

So, I tried this:

I created a file, index.pl, inside of /var/www/cgi-bin and all it has is

#!/usr/bin/perl
print "does this work\n";
via command line

$perl index.pl
does this work
but via the web, I get an Internal Server Error and in the error_log

Premature end of script headers: /var/www/cgi-bin/index.pl




print "Content-type:text/html\n\n"

before anything else to avoid this error


I'm very perplexed


Openwebmail does not require a mod_perl httpd, but the latest version (6
weeks ago) does require a suidperl. The initial setup can be a bit
daunting, but it's well worth it.







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


Re: Unable to install mod_perl using several tutorials...

2003-11-26 Thread Jonathan Villa
Sorry for the repeats

I noticed that on the top of the pages, there is

#!/usr/bin/suidperl -T

so I tried that on the command line and get this:

Script is not setuid/setgid in suidperl

???

Jonathan Villa wrote:

I did the Content-Type and nothing new...

So you're saying that Openwebmail does not require mod_perl?  This is 
the main thing I need to get setup...so perhaps I should look into the 
openwebmail forum for a solution?

The only thing that confuses me is how does a web based program work 
without mod_perl?

And how can I get the simple index.pl file to work, I think I would feel 
more comfortable once that is working...

tvilliers wrote:

On Wed, 26 Nov 2003 09:36:39 -0600, Jonathan Villa wrote:


Ok, I'm trying to install OpenWebMail but I keep getting an Internal
Server Error when I try to access it via the web.
Here is what I have/did

Installed: Apache 1.3.29/mod_ssl 2.8.16-1.3.29/PHP 4.3.4 Installed: 
v5.8.2
built for i686-linux

I'm trying to install mod_perl 1.29 and I've followed several tutorials,
many of which compile apache with mod_perl and seem to mess up my httpd
configuration.  So, what I'm trying to do is to get mod_perl working but
without having to recompile Apache.  Perhaps I already have it installed
since this is in my httpd.conf file
LoadModule perl_modulelibexec/libperl.so ScriptAlias /cgi-bin/
"/var/www/cgi-bin/" 
AllowOverride None
Options None
Order allow,deny
Allow from all

and libperl.so is indeed in the libexec dir.

Anyway, perl seems to be working because I tried 
./openwebmail-tool.pl and
it works, and if I do a perl -V I get information.

So, I tried this:

I created a file, index.pl, inside of /var/www/cgi-bin and all it has is

#!/usr/bin/perl
print "does this work\n";
via command line

$perl index.pl
does this work
but via the web, I get an Internal Server Error and in the error_log

Premature end of script headers: /var/www/cgi-bin/index.pl




print "Content-type:text/html\n\n"

before anything else to avoid this error


I'm very perplexed


Openwebmail does not require a mod_perl httpd, but the latest version (6
weeks ago) does require a suidperl. The initial setup can be a bit
daunting, but it's well worth it.







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


Re: Unable to install mod_perl using several tutorials...

2003-11-26 Thread Jonathan Villa
Ok, I should have read the FAQ for Openwebmail first... which says that 
openwebmail cannot be used with mod_perl... that would have saved me 
some time in thinking that perhaps it was because of mod_perl and 
joining this list...

thanks for at least reading this...

Jonathan Villa wrote:

Sorry for the repeats

I noticed that on the top of the pages, there is

#!/usr/bin/suidperl -T

so I tried that on the command line and get this:

Script is not setuid/setgid in suidperl

???

Jonathan Villa wrote:

I did the Content-Type and nothing new...

So you're saying that Openwebmail does not require mod_perl?  This is 
the main thing I need to get setup...so perhaps I should look into the 
openwebmail forum for a solution?

The only thing that confuses me is how does a web based program work 
without mod_perl?

And how can I get the simple index.pl file to work, I think I would 
feel more comfortable once that is working...

tvilliers wrote:

On Wed, 26 Nov 2003 09:36:39 -0600, Jonathan Villa wrote:


Ok, I'm trying to install OpenWebMail but I keep getting an Internal
Server Error when I try to access it via the web.
Here is what I have/did

Installed: Apache 1.3.29/mod_ssl 2.8.16-1.3.29/PHP 4.3.4 Installed: 
v5.8.2
built for i686-linux

I'm trying to install mod_perl 1.29 and I've followed several 
tutorials,
many of which compile apache with mod_perl and seem to mess up my httpd
configuration.  So, what I'm trying to do is to get mod_perl working 
but
without having to recompile Apache.  Perhaps I already have it 
installed
since this is in my httpd.conf file

LoadModule perl_modulelibexec/libperl.so ScriptAlias /cgi-bin/
"/var/www/cgi-bin/" 
AllowOverride None
Options None
Order allow,deny
Allow from all

and libperl.so is indeed in the libexec dir.

Anyway, perl seems to be working because I tried 
./openwebmail-tool.pl and
it works, and if I do a perl -V I get information.

So, I tried this:

I created a file, index.pl, inside of /var/www/cgi-bin and all it 
has is

#!/usr/bin/perl
print "does this work\n";
via command line

$perl index.pl
does this work
but via the web, I get an Internal Server Error and in the error_log

Premature end of script headers: /var/www/cgi-bin/index.pl






print "Content-type:text/html\n\n"

before anything else to avoid this error


I'm very perplexed




Openwebmail does not require a mod_perl httpd, but the latest version (6
weeks ago) does require a suidperl. The initial setup can be a bit
daunting, but it's well worth it.









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


  1   2   3   4   5   6   7   8   9   >