Re: apache 2 reloads needed?

2009-11-03 Thread Jonathan Vanasco


On Nov 3, 2009, at 4:27 AM, André Warnier wrote:


I see that you mention mysql.  This probably means DBI.
I think you need to be a bit careful with DBI and Apache::Reload.  I  
seem to recall that there are some particularities there

(Probably in relation to permanent cached database connections).

In any case, I believe Apache::Reload is OK for a development  
server, but on a production server this is probably not very  
efficient.
There is no free lunch : if you ask the server to monitor certain  
things and do something in case of change, then that has a cost.


re: databases-- you should be fine as long as you use Apache::DBI.  if  
you're not, then I don't recall.


Apache::Reload and Apache::DBI for mod_perl handler applications work  
perfect during development.  I've never made a registry app, so can't  
comment on that.


Apache::Reload shouldn't be used on production; however its  
indispensable during development.




Re: Plack

2009-10-15 Thread Jonathan Vanasco

On Oct 15, 2009, at 10:01 AM, Issac Goldstand wrote:


Whaddaya know...

Ironically, this might have saved Plone at my workplace had I known  
that
this was on the way.  We were looking at writing custom WSGI  
components

in Python and shuddering (well, I was shuddering)


I'm 80% Python now, so that would be exiciting to me ;)  I can't stand  
plone though, I do everything in Pylons... which is actually a lot  
like ModPerl


Porting WSGI to Perl is really awesome though. And MP is already  
supported out of the box !


Re: Plack

2009-10-15 Thread Jonathan Vanasco


On Oct 15, 2009, at 1:36 PM, Adam Prime wrote:

I haven't played with it, but i have read a bunch of Miyagawa's blog  
posts about it.  I do know that Jeff Horwitz is planning to support  
WSGI in mod_parrot / mod_perl 6, but i don't know exactly what that  
means ;)


Yeah I heard about that too.  Unfortunately, I seriously doubt I'll  
ever use Perl6.


The PSGI spec is really neat.  It's just a perl version of WSGI.  I'm  
hoping to play around with it on some spare time next month, and see  
if it can get around some of the weird stuff I've had to do with  
libapreq in the past.


Re: dealing with empty field names in query

2009-02-23 Thread Jonathan Vanasco


On Feb 13, 2009, at 5:11 PM, Joe Schaefer wrote:
We had to stop using libapreq2 for cookies, because we found out  
that wordpress
(being a shoddy piece of software) was generating invalid cookies  
at times.

when apreq encountered it, it segfaulted.


What version of apreq was this?  And did you report it to the apreq- 
dev@ mailing list?


2.07

reported to apreq-dev in 2006 : http://marc.info/?l=apreq- 
devm=113996436206606w=2


it's an edge case to cause it -- you have to somehow write a bad  
cookie, which most libraries fix for automatically.  wordpress did  
that often back then though.


Re: dealing with empty field names in query

2009-02-13 Thread Jonathan Vanasco


On Feb 6, 2009, at 4:58 PM, Phil Carmody wrote:

In those name/value pairs, according to HTML 4 at least, the names  
must begin with a letter [A-Za-z]. The empty string does not do so.  
Garbage in, garbage out.




Part of me agrees with that philosophy.

Another part of me is more practical.

We had to stop using libapreq2 for cookies, because we found out that  
wordpress (being a shoddy piece of software) was generating invalid  
cookies at times.  when apreq encountered it, it segfaulted.


so while the engineering part of me is okay with garbage in / garbage  
out, the management side of me says sometimes you have to expect bad  
data and try to make the best of it - otherwise you lose customers and  
revenue.


Re: dealing with empty field names in query

2009-02-13 Thread Jonathan Vanasco

On Feb 13, 2009, at 3:38 PM, André Warnier wrote:


The management part of me says that if you sell shoddy merchandise to
people, they are going to come back and hit you with it.
Presumably, if you get such kind of posted data from a form, it is
because you sent a shoddy form to the browser, which can submit such
shoddy data.  Or because you have some shoddy javascript in the form,
which sends shoddy data to your server.
So we're still at the garbage level, but the other way around :  
garbage

out, gargabe in.
;-)


That's assuming that you're responsible.

Today many people use misc javascript libraries; and there are js DMZ  
servers that serve off cached versions so people don't have to  
reload.  A simple typo could render your application broken.

Re: Any success with storing photos in a database?

2008-11-27 Thread Jonathan Vanasco

chiming in a few months late...

from my experience, and responding to some thoughts in the thread:

	- storing photos in mysql/pgsql is not a good idea.  aside from misc  
issues that always arise, you end up stressing the db through searches
	- the better way would be to store photo meta-data in the system,  
and then search for that to serve.   its a much leaner search and  
faster/more lightweight.


-we played around with a lot of things

-- mogilefs
 	---  i think flickr also used pre-yahoo. someone mentioned a  
flickrbook, there is also a powerpoint from about 1year after they  
launched


-- directory hashing
	--- create an md5 and store in db; store on filesystem as ab/cd/ef/ 
gh/abcdefg + suffix ( [original,-thumb ,-medium].jpg )
	 use rewrite rules on nginx to loadbalance across cluster by  
bucket and serve


	-- i didn't like perlbal, but it can do some neat in-time  
bitshifting on gifs to change the color palatte


	-- the BEST solution we found and upgraded to was.. Amazon s3 +  
Panther Express.  this is before amazon offered cdn services
	--- store files on amazon -- originals in private bucket, copies in  
public buckets
	--- serve files from panther, which was a kickass cdn.  they cache  
everything in their network , which offsets instabilities from amazon
	--- don't worry about disk usage, clustering, load balancing,  
BACKUP, and miscellaneous stuff designed around images
	--- migrating to that setup took us 2 days... and it was a better  
performer than 3 months of code and constant maintenance







Re: Share perl variables between apache process

2008-09-25 Thread Jonathan Vanasco


On Sep 24, 2008, at 3:17 PM, Perrin Harkins wrote:


On Wed, Sep 24, 2008 at 3:08 AM, badman [EMAIL PROTECTED] wrote:
For Michael, yes i know what it mean to have global variables  
(semaphores,
...) i was investigating this option because when i do call ...- 
new(); it

reads a file to initiate its attribute.
I would like to improve the performance not reading always the file


If the file doesn't change, read it into a global in the parent
process before forking.  Then you'll have it for use in the children.

For Ryan, i already see IPC::Shareable before using it i was  
investigating

some other option, but i think i'l use it :)


Be careful, IPC::Shareable is pretty slow, especially for large chunks
of data.  In most cases, an RDBMS or a dbm file ends up being faster.


also memcached can work well here


// Jonathan Vanasco

w. http://findmeon.com/user/jvanasco
e. [EMAIL PROTECTED]

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

| Founder/CEO
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - -

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




Re: mod_perl BOF at YAPC::NA

2008-06-09 Thread Jonathan Vanasco


On Jun 5, 2008, at 3:09 PM, Perrin Harkins wrote:


Count me in.  This should be fun.  Work on your mod_php jokes.


does anyone even use that anymore ? (a serious question)


Re: [OT] Solaris + Apache 2.2 / PHP 5 cluster config help

2008-05-22 Thread Jonathan Vanasco


On May 22, 2008, at 1:14 PM, Perrin Harkins wrote:


The module I'm presenting at YAPC::NA and OSCON this year,
DBIx::Router, will make it easier to add this kind of partitioning
after the fact.  It lets you set up rules to choose which database to
send a query to.  When I have a public prototype on CPAN, I'll
announce it on this list and ask for testing help.


Awesome!

Have you looked into what youtube have been presenting on, or the  
skype partitioning tools ?

Both are python, but useful - as they're massively internet scale

If you haven't seen the skype stuff:
https://developer.skype.com/SkypeGarage/DbProjects/

The whitepaper is pretty good

The stuff on parition hashing is in PL/Proxy

https://developer.skype.com/SkypeGarage/DbProjects/PlProxy




Re: [OT] Solaris + Apache 2.2 / PHP 5 cluster config help

2008-05-21 Thread Jonathan Vanasco


On May 20, 2008, at 4:00 PM, Issac Goldstand wrote:
Right - I know that in theory, but was worried about the disk/ram/ 
cpu overhead of replicating the writes to all of the slave servers  
offsetting that benefit...


The explanation i gave to this on the Pylons list today was such:

	when you're successful, you cluster to a couple of servers with  
replication
	when you're SUCCESSFUL!!, you cluster to a handful of servers  
with replication and horizontal partitioning


you honestly shouldn't have an issue with writes/reads until you have  
a hugely utilized service


you can also do psuedo-partitioning to make things work  faster--
	keep 1 DB + replication system for your app's business logic  
( accounts, meta data, etc)
	split out your sessions and logging facilities (if any) to a  
seperate box(es).  those write on every request - just give them  
entirely different boxes  databases to save to, and free up the  
write/read/replication structure for your data


personally, i think one should always architect applications with  
separate DB handles for read/write/log/session at the outset.  you  
can essentially make them 'one' handle until necessary... but it  
takes barely any time to program with that paradigm from the start...  
vs trying to retrofit in clustering to an app when its too late.


my bigger questoin on your design would be this:

why are you using apache?

off your setup, you don't seem to suggest any need for apache.  i  
think you'd be MUCH better off using nginx/lighttpd with fastCGI  .


Have you tried using APC  ( http://pecl.php.net/package/APC ) ?

I know it used to suck ass.  IIRC , APC used to be worthless and  
eAccelerator was the only thing that worked - and was great.  then  
APC was working, and eAccelerator kicked its ass.  but then  
eAccelerator broke for like 10 months, and APC worked - so it picked  
up a lot of steam.


looking at your specs, i'd toss as much ram on your http machines as  
money allows, run nginx + fastcgi on the  boxes.  give fcgi some  
generour ram and APC .5GB.  then run the rest of the box on  
memcached.  its not worth running replicants on your http machines -  
you're better off tossing the CPU to php and the RAM to memcached.



// Jonathan Vanasco

w. http://findmeon.com/user/jvanasco
e. [EMAIL PROTECTED]

|   Founder/CEO - FindMeOn, Inc.
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

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




Re: refactoring client's decision

2008-05-13 Thread Jonathan Vanasco


On May 11, 2008, at 2:52 AM, Marc Lambrichs wrote:

 Here's my view: they create a parent App::Handler and in every  
virtual host they create a Site::Handler which has App::Handler as  
base. My first guess is that under mod_perl you don't know which  
Site::Handler will be called. Ofcourse, at first, the handler  
you're actually pointing to will be called, but if you change the  
request to another virtualhost, the wrong handler will be called.


Unless I'm confused, I've been doing that for years without issue.

I routinely have

P2XLP::$package  - base namespace
MyApp::$package - @ISA( P2XLP::App::$package )

 then use agressive class inheritance and package variables /  
methods to make everything work beautifully.




Anyone here building Social Media Apps ( in mod_perl or otherwise ) ?

2008-05-09 Thread Jonathan Vanasco


If so, catch me offlist.

This will become relevant to the list next week, i promise ;)





// Jonathan Vanasco

w. http://findmeon.com/user/jvanasco
e. [EMAIL PROTECTED]

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

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


Re: Many handlers in the same module

2008-03-28 Thread Jonathan Vanasco


On Mar 27, 2008, at 8:43 PM, Colin Wetherbee wrote:
Hm.  Yep.  ResponseHandler can interpret the ::ResponseHandler part  
as being a function within Handler.pm, but that does *not* work for  
InitHandler.


i have it set up using

PerlFixupHandler
PerlResponseHandler
PerlCleanupHandler
PerlPostReadRequestHandler

I haven't tried init handler

do you have , perhaps, a conflict in packages and subs?

ie:

JetSet/Handler.pm
JetSet/Handler/ResponseHandler.pm

or something like that, where we need a difference between :: and - ?



Re: Many handlers in the same module

2008-03-28 Thread Jonathan Vanasco


On Mar 28, 2008, at 3:11 PM, Colin Wetherbee wrote:

Care to add one, just to see what happens? :)


You know you've been working too much on the Business Side when you  
stop testing stuff like that automatically.  sigh...


ok...

it works if i have


package MyApp;

sub handler {}
sub handler_init {}
sub handler_etc {}

if there is a package
MyApp::hander_init.pm

and a function
MyApp-handler_init

mp will call
MyApp-handler_init

the only way i could get get
MyApp::hander_init-handler

to call was to delete MyApp-handler_init

here's a snipped from my startup.pl

foreach my $dir ( @dirs ) {
$Location{/$dir} = {
SetHandler=  
'modperl' ,
#PerlInitHandler=  
'Apache2::Reload',
PerlInitHandler=  
'FindMeOn::handler_test',
PerlFixupHandler=  
'FindMeOn::relaunch_check',
 
PerlResponseHandler= 'FindMeOn',
PerlCleanupHandler=  
'FindMeOn::cleanup',

}
}
 


Re: Many handlers in the same module

2008-03-27 Thread Jonathan Vanasco


On Mar 26, 2008, at 9:47 AM, Colin Wetherbee wrote:
We seem to have solved the problem, but for the sake of  
conversation...


When I've tried that in the past, mod_perl would always look for  
handler() within JetSet::Handler::AccessHandler.pm.


Wow.

I've got 5 sites in production right now... and dating back to  
03/04 with multiple specified handlers like that


I've never had that issue come up, nor have i planned for it.  I  
could see that happening though


Wow... again... I never thought of that. 


Re: Many handlers in the same module

2008-03-25 Thread Jonathan Vanasco


On Mar 19, 2008, at 2:22 PM, Colin Wetherbee wrote:

PerlAccessHandler JetSet::Handler-AccessHandler
PerlResponseHandler JetSet::Handler-ResponseHandler

sub ResponseHandler
{
  my (undef, $r) = @_;
  # ...
}



what about...

PerlAccessHandler JetSet::Handler::AccessHandler

sub AccessHandler {
my ($r) = @_;
}



Re: Amazon

2008-02-29 Thread Jonathan Vanasco


On Feb 26, 2008, at 8:29 PM, J. Peng wrote:


coding from perl to python is easy,at least it's easy for me.
but,as many guys have said to me, from python to perl is not easy.
perl's many features,like the rich built-in variables and context,are
not so easy to be accetable by newbies.


I think the big issue in going from python-perl is losing the  
formatting and whitespace.  i went from perl-python -- which was  
dead simple -- and occasionally bring in python friends to help with  
perl stuff.  the only things they groan about are differences with  
the idiomatic ways to accomplish tasks, and using curly brackets


On Feb 26, 2008, at 9:06 AM, David Scott wrote:
I've seen that too.  Some engineering managers have an absolute  
phobia when it comes to Perl.  But some of these same managers turn  
right around and extol the virtues of Ruby.  Go figure.  As far as  
I can tell, beyond a lot of syntactic sugar the two are virtually  
indistinguishable - except that Perl has been around longer and  
runs a lot deeper.  Same with Python.


Perl is known as messy.  Ruby is known as clean.  I'd say ruby is  
messier than Perl, but has had 1000x more marketing materials pushed  
its way because of Rails.
I've seen too many CEOs and CTO/Tech-Directors make decisions based  
on this:

how many more people are talking about ruby than perl?
i see a lot more ruby jobs right now.
ruby is getting a big rise in usage, perl has plateaued
there are big web conferences, and fancy web 2.0 sites done in ruby
Anyone on this list could give very eloquent reasons as to why that  
line of reasoning is flawed, and show each argument as being incorrect.
The point is that people are making decisions based on questions like  
that.


I think a lot of the debate boils down to culture.  Perl people  
tend to come from a sysadmin culture and are more comfortable  
working where the rubber hits the road.  PHP people tend to come  
from web dev, and really don't see the need to go too far beyond  
dynamic web pages.  Ruby and Python people tend to be Java refugees.

I'd disagree with that a bit.
PHP and Ruby both have their root in 'web dev', but their core  
audience is more like this:
	they did java in web 1.0 because it was the next big thing with all  
the jobs
	they moved to php, because it was the new big thing that people were  
hiring for
	they moved again to ruby, because it was the new big thing that  
people are hiring for


i see SO many resumes that show 'java-php-ruby' -- and friends who  
run companies have seen the same.
whenever we see that, we pretty much toss the resume -- those people  
aren't engineers or thinkers, they're basically code monkeys who are  
trading on the current in-demand language.


Also, most people I see in python come from all over - lots of Perl  
and Java , some php, and a lot of C - they're looking more or less to  
do rapid prototyping of apps they either want to scale one day, or  
will re-write in c.
I see this group less as refugees, as they often maintain their other  
languages.  Probably 60% of the python devs I know will often write C- 
libraries to handle issues or are starting to offload onto Erlang.


But the skill set involved in writing good code is no different,  
regardless of your background.
That is 100% true.  A good person can shift languages in a  
heartbeat.  The languages all have their strengths and weaknesses,  
but are mostly just syntax and approach differences.
The good engineers know how to solve problems, with fundamentals and  
creativity - not a languag.





Re: mod_perl PPM missing Apache2::Reload

2008-02-25 Thread Jonathan Vanasco


On Feb 25, 2008, at 1:57 AM, Dami Laurent (PJ) wrote:

Hi Randy,

Thanks a lot, seems to work fine (but I didn't test very  
extensively yet).


Just one small bug in the PPM : the ppd file mentions  
Apache2::Reload, but this is not included in the tar.gz file. So I  
had to manually install it.


Apache2::Reload was just migrated out of the MP distro to external  
Perl modules on CPAN (Dec 2007)


I guess the docs on MP need to be upgraded.


Amazon

2008-02-22 Thread Jonathan Vanasco
I've heard from a few reputable sources that Amazon is looking to  
drop mod_perl, and push into another technology ( which I've also  
head is likely to be Java ).


They have a HUGE deployment on mp, and have been my prime Um, not  
enterprise?  Hello, AMAZON.  repsonse.


I know that people 'in the know' can't comment on record... however  
I'm wondering if anyone with second-hand intel has heard , and can  
share :


a- what the bottleneck / scaling issues were
	b- were these due to apache/mod_perl, or because of the framework  
implementation... and this is just an opportunity to switch  
technologies while they switch frameworks ( ie, is MP to blame, or  
Template Toolkit... and MP is taking a fall since its going to be a  
PITA to ditch TT )
	c- what the hell the financial projections were on doing this.  are  
they looking to save on hardware scaling, developer scaling, is the  
codebase just unmanageable?  this would be a costly transition





// Jonathan Vanasco

w. http://findmeon.com/user/jvanasco
e. [EMAIL PROTECTED]

|   Founder/CEO - FindMeOn, Inc.
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

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




Re: How to store keys generated from Crypt::RSA module??

2008-01-22 Thread Jonathan Vanasco


On Jan 6, 2008, at 12:37 PM, Kurt Hansen wrote:

 I'm using Crypt::RSA module for generating public  private keys.  
Now the

problem is that when I'm storing the keys in the database, and again
bringing them to do the signature or verification the Crypt::RSA  
module is
unable to understand the key format. I'm storing the keys in the  
Varchar

field of the MySQL.
Could any body tell me when storing the keys in the databases what  
would be

the type of the field or how to work with the keys??
Try the blob type. I think varchar is too short to store the  
private key in a format Crypt:RSA expects. We store the keys in  
files, but store the encrypted data in blob records.


i save as TEXT in postgres

you need to make sure that you're reading/writing them correctly.   
some modules use base16, base32, base64 ; its a PITA realizing that  
your issues are entirely with base representation.


Re: Can't use Crypt::RSA

2007-12-28 Thread Jonathan Vanasco

try using Crypt::OpenSSL::RSA

its a little faster.  there is a memory leak in it, but the max- 
requests directive will make it pretty inconsequential.




On Dec 28, 2007, at 5:37 AM, arnab wrote:



Hi Everyone,

I'm using a small script to use the Crypt::RSA module under windows  
using
Active Perl v5.8.8 but it is showing  Perl Command Line Interpreter  
has

encountered a problem and needs to close...

My script
#
#!/usr/bin/perl
use strict;
use warnings;
use Crypt::RSA;
# Use my to declare variables
my ($crypted, $data, $plain, $private, $public, $rsa);
# Set the data that will be encrypted
$data = hello;

# Create a new RSA object
$rsa = new Crypt::RSA or die Unable to create RSA object!\r\n;

# Generate a public private key pair
($public, $private) = $rsa-keygen(Size = 1024) or
die Unable to create key pair!\r\n;

undef($rsa);


Could any body please suggest what may be the parameter for the  
function

call $rsa-keygen(

Thanks in advance.

Arnab


--
View this message in context: http://www.nabble.com/Can%27t-use- 
Crypt%3A%3ARSA-tp14524284p14524284.html

Sent from the mod_perl - General mailing list archive at Nabble.com.





Re: re-factoring 'print' for $r

2007-12-23 Thread Jonathan Vanasco


On Dec 23, 2007, at 1:53 AM, [EMAIL PROTECTED] wrote:

I think the print magic only happens if you are running under  
SetHandler perl-script, and not if you are running under SetHandler  
modperl.


Ah, that seems to be it.

I never used perl-script ; I went straight for modperl when i did the  
transition ;)


Re: Find the values of Apache2::Const

2007-12-23 Thread Jonathan Vanasco


On Dec 22, 2007, at 11:53 AM, Adam Prime wrote:
I believe in this situation what you want is $r-status 
(Apache::Const::HTTP_OK).  HTTP_OK and OK are not the same thing  
at all.


It's a mean trick...  one is an HTTP constant, the other is a  
mod_perl constant ( ie HTTP_ prefix and no prefix )


not having the codes in the docs is annoying too - we argued about  
this in august 06 , and Fred Moyer was excellent enough to create a  
patch to the MP source to fix this


Subject:Re: status codes in Apache2::Const ?
From: [EMAIL PROTECTED]
Date:   September 2, 2006 2:45:36 AM EDT

oddly ( i never realized this before ) the patch is not in  
Apache2::Const, but in


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


we should probably link the Apache2::Const docs to the new handlers  
doc section


Re: re-factoring 'print' for $r

2007-12-22 Thread Jonathan Vanasco


On Dec 22, 2007, at 4:47 PM, Perrin Harkins wrote:

By the way, if you just call print() normally it should all be grabbed
by mod_perl anyway.  Is there some reason you need to call $r-print()
instead?


I thought it only does that if you bind STDOUT the right way on  
compile time, otherwise it just gets lost in the ether


If you're using a $r you stash somewhere, make sure you undef it on a  
cleanup - just to be safe


also, instead of
$mnh::r-print( $package_response );

you could do something like...

mnh::r::printer( $package_response );

where

package mnh::r;

our $r;
function printer {
if ( !defined $r ) {
$r= #get $r;
$r-print( $_[0] )
}
}

for the performance hit, you can now swap how you print without  
findreplace again


Re: register_cleanup

2007-12-19 Thread Jonathan Vanasco
I'm surprised you're even getting a redirect, this doesn't make sense  
to me.   the MP cleanup handler is supposed to happen after the  
request is served / client connection is terminated (docs below)


if you're trying to do a redirect after processing, try a stacked  
handler


http://perl.apache.org/docs/2.0/user/handlers/ 
http.html#PerlCleanupHandler
	There is no cleanup Apache phase, it exists only inside mod_perl. It  
is used to execute some code immediately after the request has been  
served (the client went away) and before the request object is  
destroyed.
	There are several usages for this use phase. The obvious one is to  
run a cleanup code, for example removing temporarily created files.  
The less obvious is to use this phase instead of PerlLogHandler if  
the logging operation is time consuming. This approach allows to free  
the client as soon as the response is sent.





On Dec 13, 2007, at 4:18 PM, Rolf Schaufelberger wrote:


On Wednesday 12 December 2007 23:44:40 Perrin Harkins wrote:

On Dec 12, 2007 2:05 PM, Rolf Schaufelberger [EMAIL PROTECTED] wrote:

  my $r = $self-{__apache_req__};


Yikes, be careful of storing Apache2::RequestRec objects.  Terrible
things will happen if you try to access one from a previous request.


  $r-pool-cleanup_register (\cleanup, {name= 'test', cnt=10});


Try $r-push_handlers(PerlCleanupHandler = \cleanup);

- Perrin


tried this, same result (redirect takes place after cleanup  
function has

finished).

--
Rolf Schaufelberger




Re: Flex

2007-12-05 Thread Jonathan Vanasco


On Dec 3, 2007, at 6:30 PM, Boysenberry Payne wrote:

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

up the static renditions.


We do some dynamic SWF generation via mod_perl; there are some  
actionscript bytecode compilers under perl

There's also a decent Python and Erlang library out there too.

For anything dynamic, its pretty simple- you can merge swfs, do simple  
actions / var publishers as wrappers which load desgined flash files,  
etc.


not very hard!


Re: Flex

2007-12-05 Thread Jonathan Vanasco


Ext is good.  Personally, I like the MochiKit system (though a good  
friend maintains it).  A few of the big-guys use it for all their  
internal systems.


It has a neat dev enviroment - even has an interpreter for you to dev  
in.

http://mochikit.com/examples/interpreter/index.html

On Dec 2, 2007, at 6:30 PM, Perrin Harkins wrote:


On Dec 2, 2007 6:10 PM, David Scott [EMAIL PROTECTED] wrote:
AJAX is anything but time-consuming once you get the hang of it.  I  
much

prefer it to traditional server-side dynamic page construction, which
really is time-consuming.


My experience has been that even the best JavaScript tools (Firebug)
are pretty weak compared to the Perl dev environment, and
cross-browser problems are an ongoing issue, despite the wealth of JS
libraries intended to paper over them.  Maybe Flex has these problems
too, but in theory the cross-browser stuff could be better.

It also sound nice to use a dev tool that was actually intended for
GUI programming, rather than the bolted-on feel of JS + CSS + HTML.




Re: Flex

2007-12-05 Thread Jonathan Vanasco


On Dec 3, 2007, at 6:30 PM, Boysenberry Payne wrote:

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

up the static renditions.


We do some dynamic SWF generation via mod_perl; there are some  
actionscript bytecode compilers under perl

There's also a decent Python and Erlang library out there too.

For anything dynamic, its pretty simple- you can merge swfs, do simple  
actions / var publishers as wrappers which load desgined flash files,  
etc.


not very hard!


Re: Apache offers to download the perl script rather than execute it!

2007-11-20 Thread Jonathan Vanasco


What does it download?


print Content-type: text/plain\n\n;
print Mod Perl 2 Rocks\n;


or

Mod Perl 2 Rocks

?




Re: Losing Variables under Apache2 Reload

2007-11-19 Thread Jonathan Vanasco


On Nov 18, 2007, at 11:00 PM, Perrin Harkins wrote:

Okay, the copy/paste error just confused me.

In any case, Apache2::Reload wipes all package variables.  It uses
ModPerl::Util::unload_package.  So, this is the intended behavior.  My
general advice is to only used Apache2::Reload on a dev server, but if
you do use it on production, you definitely can't use it on modules
that keep global data you don't want cleared.



That's what I feared/expected.

Does anyone know of a way to force mp to run certain blocks on a  
package reload?
This is just for my dev server... so its not that important.  It  
would just be less aggravation on my part.


- The package hash is cleared on reload
- The package hash is populated by other files being compiled and a  
register function being called


ideally it would be something like:

on_reload {
reload_these( @namespaces );
}

i think this is currently unsupported, so i'm not hoping for  
anything.  just worth asking.


Losing Variables under Apache2 Reload

2007-11-18 Thread Jonathan Vanasco

I'm losing variables under apache2:: reload

below is a summation of my problem.  when a2::reload recompiles off  
of a changed sub, i lose the entire WATCH_ME var.


i think this might happen because of the begin blocks.  and the way  
plugins register.  i thought it wise to bring this up though, see if  
there is a way i can keep testing without periodic restarts.



package myapp::tester;
use Data::Dumper();
our %WATCH_ME;
BEGIN {
sub register_plugin {
my ( $package )= @_;
$WATCH_ME= \ ${$package.'::var'};
}
Module::List::Pluggable::import_modules( myapp::tester );
}
sub edit_me {
print After running 1x, delete this line and save;
print Data::Dumper::Dumper(\%WATCH_ME);
};
1;

package myapp::page;
myapp::tester:: edit_me();
1;




Re: Losing Variables under Apache2 Reload

2007-11-18 Thread Jonathan Vanasco

WATCH_ME is populated by subclasses that register on load.

on my dev server, the real WATCH_ME var has about 96 registered  
modules in it.  everything works perfect until i reload.



package myapp::tester::plugin;
our $var= 'hello';
myapp::tester::register_plugin(__PACKAGE__);
1;


the correct sub in the superclass is:

sub register_plugin {
my ( $package )= @_;
$WATCH_ME{$package}= \ ${$package.'::var'};
}

$var is actually a regex.  this is all essentially the guts of the  
dispatcher to a  factory class




On Nov 18, 2007, at 10:37 PM, Perrin Harkins wrote:

On Nov 18, 2007 7:30 PM, Jonathan Vanasco [EMAIL PROTECTED]  
wrote:

below is a summation of my problem.  when a2::reload recompiles off
of a changed sub, i lose the entire WATCH_ME var.


What would this code do if it was working?  %WATCH_ME doesn't look
like anything ever gets put into it.  Does this compile with strict
and warnings on?

- Perrin




Re: [Question] mod_perl2 W3C HTML Tidy handler location

2007-11-16 Thread Jonathan Vanasco


On Nov 16, 2007, at 6:13 PM, Fred Moyer wrote:

I'm pretty sure you can use Apache::Clean as an output filter to do  
this.


http://search.cpan.org/~geoff/Apache-Clean-2.00_7/


I believe the OP wanted the exact opposite

I *hope* this is for a dev-only use - as it would be really silly to  
tidy up stuff to clients.


Personally, I use stuff like Clean on my templates when I compile  
them on startup (clean 1x, server 100x)


For the OP's needs, a pure-perl solution would be:

http://www.perlmonks.org/? =308488
http://thraxil.org/users/anders/posts/2003/11/21/Apache--Tidy/

However you'd be better off (I think) with a c-lib on apache that  
uses the TidyLib directly

http://mod-tidy.sourceforge.net/

the suse package gives a good description:
	http://www.novell.com/products/linuxpackages/suselinux/apache2- 
mod_tidy.html

mod_tidy is a module for Apache that works as a filter that hooks
itself to HTML output. mod_tidy feeds the HTML output to TidyLib
(http://tidy.sourceforge.net/), which validates the HTML output. If
TidyLib finds an error, the client receives a HTML page with a list of
all found errors. If TidyLib does not complain, you get your HTML data
as without mod_tidy.
To load the module into Apache, add it to APACHE_MODULES in
/etc/sysconfig/apache2 ('a2enmod mod_tidy'). To learn about the
configuration, refer to
/usr/share/doc/packages/apache2-mod_tidy/README.




// Jonathan Vanasco

w. http://findmeon.com/user/jvanasco
e. [EMAIL PROTECTED]

|   Founder/CEO - FindMeOn, Inc.
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

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



|   Founder - RoadSound.com
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

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







OffTopic (slightly) - Module Feedback Wanted - Authen::Ticketless

2007-11-13 Thread Jonathan Vanasco
I needed to create an authentication system to handle logins to my  
mod_perl app via Flash and JS


My first thought was to use CRAM-MD5 , but there wasn't a way to do  
that without relying on cookies or a db to handle the challenge


What I came up with was a Ticketless CRAM system (that uses md5 by  
default, but can be extended to use sha1 or any other digester via a  
subclass that has isolated all of the digest functions )


It creates a challenge in this format:
%(time_start)s::%(seed)s::%(checksum)s
where checksum is
MD5( $time_start . $seed . $site_secret )
Therefore:
the time window of validity can be controlled
there is no need to store / session stuff on the server

Any feedback would be greatly appreciated

I'm most concerned about:
a-  Security Concerns
		i. I sketched this out during brunch on a napkin.  Please tear  
apart if this is unsuitable for production

b-  Module Design
		i. the Authen::Ticketless package just wraps the CRAM subpackage  
and is almost needless for that.  I almost did this as  
Authen::Ticketless::CRAM , and left the Authen::Ticketless namespace  
empty



The SVN is here:

http://dev.2xlp.com/svn/mod_perl/Authen::Ticketless/trunk/






// Jonathan Vanasco

w. http://findmeon.com/user/jvanasco
e. [EMAIL PROTECTED]

|   Founder/CEO - FindMeOn, Inc.
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

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



|   Founder - RoadSound.com
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

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




Re: OffTopic (slightly) - Module Feedback Wanted - Authen::Ticketless

2007-11-13 Thread Jonathan Vanasco


On Nov 13, 2007, at 11:48 AM, Michael Peters wrote:
Why is this considered ticketless? Isn't the challenge that you  
mention below
really a ticket? And does the client need to present this ticket on  
every request?


Yes, you're right - the challenge is a ticket -- and must be  
presented on every request.
Perhaps this is a very bad semantic naming -- I meant that there is  
no local store on the ticket - as it is self-validating.


Sounds an awful lot like mod_auth_tkt to me, or am I missing  
something?


Its like mod_auth_tkt in design , but not in function

mod_auth_tkt does apache auth via cookies and apache - i need to  
support a non-cookie and non-apache environment


this is meant to offer a security layer when doing a form style login  
via Flash or Javascript over an insecure connection - so that a user  
password is never sent in the open


i'm in the midst of writing the corollary flash and js libraries too

maybe mod_auth_tkt can support that via specific calls ?


Re: OffTopic (slightly) - Module Feedback Wanted - Authen::Ticketless

2007-11-13 Thread Jonathan Vanasco
But there is a big security whole there if you skip the trip to the  
server
(whether or not you use mod_auth_tkt). In order for the Flash code  
or JS code to
create a ticket using a shared secret that secret needs to be  
downloaded to the
client. Now you might be relying on Flash's binary format to  
protect said
secret, but I wouldn't. Sending a user/pw combo on an insecure  
connection is not
as bad as sending your shared secret out into the open on the same  
insecure
connection. The first compromises that user's account. The second  
compromises

every users account.


Right , but this module doesn't do that.  This module uses the CRAM- 
MD5 style of authentication - like SMTP servers use


client: Hey I want to log in!
server: Here's a Challenge: $time. $seed . digest ($time . $seed .  
$site_secret )
client: Here is my username and a hash that is Digest( password ,  
server_challenge )
server: I looked up your username in the db , and the password is  
'abc' .  if i hash the stored password with the server_challenge I  
sent you, i get the hash you send me.  i will log you in now.


things to note though:
	i. if you store plaintext passwords on the server (BAD!) the client  
sends

digest( password . server_challenge)
	ii. if you store hashed passwords on the server (GOOD!) the client  
sends

digest( digest(password) . server_challenge)
	iii. this module creates a self-validating challenge, so that you  
don't have to store the challenge on the server - so you send the  
challenge back to the server


so to answer your concern:
a. the user/pw combo is never sent on an insecure connection
	b. the server challenge is just used as a digest seed to give more  
security over sending an unseeded digested password and limit replay  
attacks.




// Jonathan Vanasco

w. http://findmeon.com/user/jvanasco
e. [EMAIL PROTECTED]

|   Founder/CEO - FindMeOn, Inc.
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

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



|   Founder - RoadSound.com
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

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







Re: OffTopic (slightly) - Module Feedback Wanted - Authen::Ticketless

2007-11-13 Thread Jonathan Vanasco


On Nov 13, 2007, at 3:04 PM, Dodger wrote:


Something doesn't sound right with this assessment. Stealing the
digest(password) wouldn't let you in on a different connection because
you'd be using a different seed on a different connection...


Yes, you're right , as is your example.

However, the difference / security flaw with my system is that its  
doing a sessionless (on the server) seed.
The more correct way to do this is to do a 'one time pad' / nonce on  
the seed via a socket connection (ie. smtp servers), a cookie system,  
or even a local expiry.


Philippe was talking about Digest Access Authentication, which is a  
more secure version of CRAM ;
My friend Rob @ Mozilla actually did a recent rewrite of that last  
year for their browser ( http://franklinmint.fm/2006/03/03/draft- 
sayre-http-hmac-digest-00.html )- he's on vacation now, but I'm gonna  
try and drag him into this.



On Nov 13, 2007, at 2:23 PM, Philippe M. Chiasson wrote:

The conceptual problem with this approach is that the digest(password)
effectively becomes the user's password.

If you steal digest(password), you can impersonnate the user, without
ever knowing password. So, somebody stealing a dump of your user  
database

can still impersonnate all your users.


That is correct.  However I've never needed a better way of storing  
user passwords other than

DIGEST( user_password )
or
DIGEST( user_password . public seed )
And a scary number of applications still store passwords as  
plaintext.  If the database is compromised, the users can be  
impersonated, but their password is not compromised.
I'm eager to hear any suggestions on password storage that can  
improve what I'm already doing -- which is at the more-secure end of  
the status quo.



Then a malicious attacker that stole a bunch of digest(password) can
pre-calculate a single 'challenge' and pre-generate a single  
challenge/digest(digest(password) . challenge))
pair per account he/she stole. Then can use them to login straight  
at the 3 step

of the authentication process with very little work on his/her side.


the challenges are usable for 30seconds by default, and require  
hacking the server itself to find learn the server's secret key that  
is used to generate the challenges (which are tested for validity  
based both on time and a referential checksum).  if someone knows the  
server secret, then their ability to impersonate a user to the system  
is of little concern - they already must have assumed control.


That being said -
	i. i'd like to explore Digest Access more, as a replacement for CRAM- 
MD5
	ii. i need to support this sessionless/not-time-based system,  
however I'll work on a way to make recording/expiring of challenges  
as a nonce possible
	iii. i'd love to hear advanced strategies on stories user-passwords  
for webapps.




Re: Building mod_perl2 on Leopard

2007-11-12 Thread Jonathan Vanasco


On Nov 10, 2007, at 8:00 PM, Hendrik Van Belleghem wrote:
To be honest, I haven't been able to get DBD::mysql compiled, nor  
Apache2::Request (properly - still some strange errors in the  
apache2 error log when I try to load it).
I haven't fully tested the Apache2 (or mod_perl for that matter).  
I'm not building it with PHP but it does appear to come with  
leopard, as does mysql.
Some threads discuss installing DBD::mysql on leopard (occasionally  
suggesting older versions of the module). Should I post some build  
output? :)


I'm curious- Why have you opted for using the stock Apache2 install?

By habit I always build from source and toss in /usr/local/apache2--  
Apple doesn't really maintain those apps after initial release.


I usually install libapreq through the c configure, not perl  
wrapper.  i've had better luck


	./configure --with-expat=/usr/local/apr  --with-apache2-apxs=/usr/ 
local/apache2/bin/apxs --enable-perl-glue

make
make test
make install


Re: simple profiling capability

2007-11-12 Thread Jonathan Vanasco

i'm just tossing this idea out...

1) have a profiler package that handles all the logging, etc - and  
uses a constant


package MyApp:::Profiler;
use constant DO_PROFILE= 1;
sub profile {
my ( $marker )= @_ ;
#log;
}
1;

2) in your app code, do this:
	MyApp:::Profiler::DO_PROFILE  MyApp:::Profiler::profile( 'some  
identifier' );


My rationale:
	a) creating the namespace / etc means you can just wrap whatever  
method you want cleanly
	b) mp will optimize away the calls to profile if you start the  
server with DO_PROFILE set to 0 -- this way you don't have to deal  
with a performance hit in production and can leave the calls intact  
as-is.


in terms of actually recording...

i'd probably stack everything into a local variable as an array ;  
then id drop in a cleanup handler that calls a function to write it  
to disk or memory somehow... you'd have to have a reset within the  
package that clears out the var too


my  @profile;
sub profile {
my ( $marker )= @_ ;
push @profile , $marker;
}
sub cleanup {
# record
record( [EMAIL PROTECTED] );
# reset
@profile= ();
}

in any event , the bulk of my suggestions are this:
	1- there's no reason to continually write to disk or shared mem , or  
call misc functions  ( unless you're profiling in-time ).  just store  
that stuff in a perl structure and dump 1x.
	2- use the optimize-away hack with constants to quickly turn off  
your debug code




On Nov 12, 2007, at 10:42 AM, E R wrote:


Hi,

I have the need for a simple profiling capability for mod_perl  
applications.

At a few ( 50) points in my code I want to call something like:

$profiler-mark(some identifier);

and increment the counter for some identifier. Later I want to be  
able to get

(through a web page) a summary (grouped by identifiers) of all the
profiling calls
made (of course, made by all Apache child processes.) For instance,  
if I want
to profile the number of times a particular subroutine was called,  
I would use:


sub mysubroutine {
  $profiler-mark(in mysubroutine);
  ...
}

This is very similar to logging, except for the summary part. Does  
anyone

have ideas of a good way to implement this? Shared memory? An external
daemon to record these calls? Has someone already implemented this?
Robust and simple are good.

Thanks,

ER




Re: Building mod_perl2 on Leopard

2007-11-10 Thread Jonathan Vanasco


Slightly off-topic:

	The 10.2 10.3 and maybe 10.4 versions of Apache that came with OS X  
had library conflicts with mysql/php if you tried to compile modperl  
1 or 2


	Can I interpret your post to mean that one does not have to rebuild  
Apache2 now too?





On Nov 10, 2007, at 9:56 AM, Hendrik Van Belleghem wrote:


Hi,

I was one of those many people lining up to get Leopard (Mac OS X  
10.5). It comes with Apache2 but not with mod_perl2.. I got into  
some problems getting it to compile properly. I've described quite  
a bit of the process on my blog but this is the short version (YMMV):


   export ARCHFLAGS=-arch x86_64

Compile/install as usual

The platform should be indicate as image type by looking at the  
signature


file /usr/libexec/apache2/mod_perl.so This worked on my intel based  
macbook..


Some more details on the fix:
http://use.perl.org/article.pl?sid=07/11/09/2241222

Initial problem description:
http://use.perl.org/~Beatnik/journal/34862

--
Hendrik Van Belleghem
Spine - The backbone for your website - http://spine.sf.net




Re: caching reverse proxy config+init scripts

2007-11-08 Thread Jonathan Vanasco


On Nov 8, 2007, at 5:50 AM, Clinton Gormley wrote:


Pound (http://www.apsis.ch/pound/index_html) is light-weight, easy to
configure, fast, stable, and makes the whole SSL and load balancing  
dead

easy.


I can disagree -- nginx does everything that pound does, plus will  
handle your vanilla static files and even use fcgi to handle php and  
other stuff


its heavenly



Re: caching reverse proxy config+init scripts

2007-11-08 Thread Jonathan Vanasco


On Nov 8, 2007, at 1:40 PM, John ORourke wrote:

Pound (http://www.apsis.ch/pound/index_html) is light-weight,  
easy to
I can disagree -- nginx does everything that pound does, plus  
will  handle your vanilla


FLAME WAR!!!1!1!


well its not meant to flame... your options are this:

a)
pound
apache-vanilla
apache-mod_perl

or

b1)
apache-vanilla+proxy
apache-mod_perl

b2)
nginx
apache-mod_perl

b2 has the least preferences

if you're serving static content, go with nginx.  if you're not, go  
with pound.  differnet tool for different jobs.



Seriously though, it looks as though there are 5-10 good front end  
server options which support the following to various degrees:


- reverse proxy
- caching
- load balancing
- static file serving

There is no clear choice since our setups range from single low  
spec boxes to multi-server solutions with load balancing and big  
fat caches.


Does anyone fancy doing an unbiased comparison for perl.apache.org?


I'd suggest another approach:

lets all opt-in (offlist?) to state what our favorite front-end it,  
and our experience on it in those 4 areas.
then we'll have the people of each app agree on their config and  
description - then a central person will coordinate.  maybe even do a  
quick bench?


i *could* write something, but I'd spend 1/2 the paper shittalking  
lighttpd for my own experience having memory leaks / process growth;  
i'm decent with squid, but awful with pound.  i'm pretty positive  
everyone else here will be similar but to different apps.














Re: mod_perl MVC framework.

2007-10-26 Thread Jonathan Vanasco

On Oct 24, 2007, at 10:37 PM, Foo JH wrote:

What is fast to cook, good to eat is HTML::Template. No XML, easy  
abstraction between your web designer and developer.



I GREATLY prefer using TAL ( in perl using Petal ) for the V

someone finally made an integration for Petal and Catalyst.   
unfortunately I've build my own MVC since then



I like TAL because its cross platform - its easy to offload urls into  
php or python and reuse all of your templates
TAL does have a downside- as do all the other templating languages -  
they've all alllowed feature creep to turn them into micro-languages  
or processing languages.


Whatever you use, MAKE SURE  you keep as much of the convenience  
code / templater speciific text out of your templates.  That stuff is  
neat and useful, but it blends designer and programmer way too much.   
It will drive you insane.


Re: Correct way to upload a file

2007-08-10 Thread Jonathan Vanasco


On Aug 10, 2007, at 10:25 PM, Mag Gam wrote:

I have just started learning perl and mod_perl, and I must admit I  
am enjoying it a lot!
I am tying to upload a file, so I can do some calculations to the  
file, my question is what is the correct and most efficient way  
to upload the file, and perform the calculations? Should I consider  
using the CGI module?


libapreq
http://httpd.apache.org/apreq/

CGI is a close second


Re: [RELEASE CANDIDATE] libapreq2 2.09-RC2

2007-08-07 Thread Jonathan Vanasco



Are we going to have 2.09 release? It's been quite some time since  
RC2
actually, i'd like to see an RC3-- there was an issue I kept  
complaining about  that Joe was going to solve thanks to some testing  
by [EMAIL PROTECTED] -- reference the posting on 2007.05.25


Supposedly, this is going to lighten up after August when my  
startup goes lives (Aug 10).

congrats!

what are you doing there, if you don't mind me asking... i noticed  
that they were hiring ruby people a while back.  i feared we lost you.





Re: X_FORWARDED_FOR original IP

2007-08-03 Thread Jonathan Vanasco


On Aug 3, 2007, at 7:03 AM, Torsten Foertsch wrote:

This idea won't work in general. First, not all proxies set an X- 
Forwarded-For
header. Second, many proxies sit in front of private networks  
10.0.0.0/8 or
172.16.0.0/16 or 192.168.0.0/16 or 127.0.0.0/8. If they set the  
header you
get different clients with the same IP-address. Also, be aware that  
a request

can travel through multiple proxies. Thus, you can get multiple
X-Forwarded-For headers.


I'll go a step further, and say that this is a particularly bad  
idea.  ( for essentially the same reasons above ).


The only proxy server headers you should care about or trust are  
those that are from your own LAN.


Your firewall/gateway/whatever should ideally strip the x-forwarded- 
for , or rename it to something else.  xff should your internal lan  
marking.  its trivial for people to spoof headers, its trivial for  
poorly designed networks to just insert inane headers as well.


Its not a matter of whether its feasable to access that information -  
its just that the information is worthless and not trustable simply  
by the design of the protocol and current global implementations.


in almost any case, using these will lead to issues in your system .


That said, for header manipulation, you can reference these module
MP1 http://search.cpan.org/dist/Apache-ForwardedFor/
MP2 http://search.cpan.org/dist/Apache2-xForwardedFor

note they both operate as a handler and override the info in $r ; you  
ESPECIALLY DO NOT want to do that in your case



// Jonathan Vanasco

Founder/President - FindMeOn
Fonder/CEO - RoadSound
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

|  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: reverse proxy/logging problem

2007-08-02 Thread Jonathan Vanasco


On Aug 2, 2007, at 11:07 AM, Carl Johnstone wrote:


I've got a two-apache reverse proxy setup, split over two hosts.

The problem I've got is that I'd like to put the user_id in the  
access logs so that our log analysis software can make use of it.


Setting apache-user correctly logs the user at the back-end  
however the IP addresses are wrong, being the internal address of  
the front-end proxy. Also requests dealt with purely at the front- 
end aren't logged.


This should help you outright, or you can pull out code for your own use
	http://search.cpan.org/~jvanasco/Apache2-xForwardedFor-0.04/lib/ 
Apache2/xForwardedFor.pm


Logging at the front-end means all requests are logged with the  
right IP address. Additional bonuses for me are that those servers  
are less loaded, and I'd be able to turn off logging at the back- 
end. However the user_id isn't available.


Is there any easy way to pass the user_id from the back-end in such  
a way the front-end could log it? Or is there another option?


you should likely be able to roll your own based on the above.



Re: mod_perl2 and SDBM-tied hashes

2007-07-29 Thread Jonathan Vanasco


On Jul 29, 2007, at 12:15 PM, Brian Reichert wrote:

But, that contradicts the behavior I see with my command-line tool  
demo:
distinct processes with distinct tied hashes can sucessfully share  
data

through the sdbm.  :/
any reason why you're using sdbm ?  you might be better off with bdb,  
since it has that shared memory cache feature.



It's not the same hash, it's a hash at the same memory location in  
each of
your processes. If your process is deterministic and the hash is  
created
either in the apache parent or at the same point after forking,  
then it will

get the same memory address in each child.
are you sure about that?   i thought they were different in each  
child, and I thought if you access it via copy-on-write it'll move to  
a new space.




If it's a factor:

RedHat's apache2 RPM defaults to the prefork MPM.  If I try to use
the worker MPM, I get a 'free(): invalidpointer' error.
you generally don't want to use worker under modperl, and you  
generlaly do want to use prefork.
The RedHat RPMs tend to be outdated,  especially for modperl.  You're  
often best suited building apache and modperl from source.





Re: php/mod_perl + mysql woes

2007-07-20 Thread Jonathan Vanasco


On Jul 20, 2007, at 8:44 AM, Michael Peters wrote:


For some reason, some people are hesitant
to run multiple versions of apache on the same machine, but there  
are lots of

people who do it all the time and it works out just fine.

If you're concerned about running 3 apaches (1 for mod_perl, 1 for  
PHP and 1 for

the proxy) then you can use a smaller lightweight proxy like squid.


off the top  of my head, there were a lot of  library conflicts  
between mp and php regarding mysql at some point.  the fix was to  
compile everything from source.  it has to deal with the way the   
distros were bundling php/mysql onto apache.  that could easily be  
your problem.


you can also just run 1 version of apache w/3 config files ...

you should never run php  mod_perl on the same server for content  
generation (  if you're doing auth/filltering, thats another story ).  
they have completely different designs regarding memory use and  
application flow.  you're wasting a ton of resources doing it like that.


i know i advocate this ad-nauseum, but its fucking fast and simple to  
set up:


port 80: nginx
	port 8000-9000: whatever mod_perl stuff you want, either by port or  
vhost on a single port

php: run via fast-cgi through nginx

you don't need to do php in apache.  you're likely better off getting  
php out of apache : if you're running both dso's loaded into a  
server, its competing against mod_perl for resources ( children , max  
requests cause respawns, etc ) ; if you split out into multiple  
servers, you're dealing with the apache overhead.  you can just  
forget apache and run php without it.  it works.  it works really  
really well.





Re: Confused Apache::DBI (best practice)

2007-07-17 Thread Jonathan Vanasco


On Jul 17, 2007, at 6:31 AM, Clinton Gormley wrote:

You should not share connections between processes.  You will end up
with segfaults.


Thats a 'best case scenario'.  More typically, you'll just have a ton  
of transactional issues and not have any integrity on your database  
of app/db logic.






On 7/17/07, Clinton Gormley [EMAIL PROTECTED] wrote:

But yes, 150 connections may be a lot depending on your database.
However, if you need 150 mod_perl children, then it is a busy  
site, and

you need a database server big enough to support it.


Anthony, Clinton is right.  I suspect you haven't done an assessment
of how many mod_perl processes you can fit on your hardware.  If each
one took 50MB (very possible), you would need more than 7GB of RAM in
your mod_perl machine to run 150 processes, or else a cluster with
that much RAM.


Seconded.   can you even run 150?  i've got 4gb on mine, and we max  
out at 20.  sure, we can spawn 150, but after 20 there hasn't been  
any added benefit ( law of diminishing marginal utility ) and after  
30 we ran into memory issues ( as memory unshares, you can run less  
processes ).  we found 20 ideal for our current setup.  your milage  
may vary (and ours has as the codebase is tweaked )



If you do these things and you still need more connections, Oracle
does provide tools for pooling connections at the database server
itself.  You can ask your DBAs about them.  Being Oracle DBAs, they
will probably just say it doesn't work and refuse to try it, but it
may be worth checking.  You can also look at sqlrelay.


i'll second sqlrelay.  its great.



This is the key to remember.  Pooling connections is only useful if
you have open connections in processes that are sitting around doing
nothing.  That should not be the case if you tune your mod_perl as
suggested above.


pooling connections can also be useful if you segment db connections  
and transactions within a request cycle.  ie: if you only need to  
read a single table on an early phase , you should be able to pool 2  
connections for 10 children , as any wait time will be offset by db  
blocking in later request cycles of your app.  thats theoretical  
though, i haven't had the need/time to try that, but i'm convinced it  
will work!




// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

| Founder/CTO/CVO
|  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: auto_index extension to filter on update time

2007-07-16 Thread Jonathan Vanasco


On Jul 16, 2007, at 3:53 PM, Thomas Hilbig wrote:


Does anyone have any MP code to extend the
functionality of the mod_autoindex to include a new
filter that is based on files that are before or after
a last-modified date?

Please excuse my lack of MP handler experience, I
don't know how easy (or not) this would be.  It seems
that this kind of filter would be useful to have in
mod_autoindex for detecting new files regardless of
their name.  mod_autoindex can currently only sort by
last-modified date, but not filter like it can with
the filename.



I think you'd have to rewrite mod_autoindex to get your functionality.

However, that wouldn't be very hard to do in MP .


// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

| Founder/CTO/CVO
|  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: berkeleyDB tie once and forever with mod_perl

2007-07-13 Thread Jonathan Vanasco


First off-  thank you perrin , i'm a step closer to fully  
understanding this.



On Jul 12, 2007, at 9:14 PM, Perrin Harkins wrote:


No.  This is explicit shared memory, not a mysterious copy-on-write
thing.  You need to initiate access separately from each process so
that none of the XS stuff is shared, just as you would with RDBMS
connections.


I knew all that...


There might be some way to safely open the database in the parent
process, especially if you're doing read-only access, or it might be
smart enough to figure out the PID changed and do whatever it needs to
do.  Feel free to comb the BDB docs for it.  I don't think there's any
advantage to doing so though.


I think this touches on what my issue was...

in order to keep the memory shared, wouldn't you have to always have  
an open process?  Wouldn't the only way to ensure this be to open up  
something pre-fork, in the apache parent?


I'm thinking of the situation where you have 1 parent, 4 children.   
all 4 children hit max-requests and exit before the first replacement  
spawns.  without a standing connection in the parent (or another  
process using bdb in any way ) wouldn't that memory be released back  
to the system , and a new memory space be started on the spawn?


i know this is an edge case... i'm just trying to wrap my head around  
the whole thing to see if this behaves as I think it does.




Re: berkeleyDB tie once and forever with mod_perl

2007-07-13 Thread Jonathan Vanasco


On Jul 13, 2007, at 9:48 AM, Perrin Harkins wrote:


On 7/13/07, Jonathan Vanasco [EMAIL PROTECTED] wrote:

I'm thinking of the situation where you have 1 parent, 4 children.
all 4 children hit max-requests and exit before the first replacement
spawns.  without a standing connection in the parent (or another
process using bdb in any way ) wouldn't that memory be released back
to the system , and a new memory space be started on the spawn?


Sure, but if all your children exit at once, BerkeleyDB cache is the
least of your worries.  It will never happen.  And even in this case,
when they all respawn and create a new segment, there will be no loss
of data.  The worst case is that the cache is cleared.



ok.  this works as I understand it then.  thanks!




// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

| Founder/CTO/CVO
|  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: berkeleyDB tie once and forever with mod_perl

2007-07-12 Thread Jonathan Vanasco

Could you elaborate on this?

I'm a bit unclear:

are you suggesting

a) the tie be global pre-fork
b) the tie be post-fork
	c) there be no tie whatsoever , and somehow a connection is made  
using the API at the beginning , and everything just uses the library/ 
api methods


?

my understanding of the bdb integration w/modperl, thanks to bits   
pieces from perrin over the years , is that bdb takes care of its own  
locking / access  pools a bunch of shared memory


that said,  it seems that in order to keep the shared memory around,  
you'd need to start some connection pre-fork.  the child-init stuff  
suggests that there are multiple post-fork connections though.   so   
i'm a bit lost.


thanks


Re: how do I clear stale POST data?

2007-07-11 Thread Jonathan Vanasco


On Jul 11, 2007, at 8:43 AM, Scott Kaplan wrote:


Situation:
= User puts in username  password into a form (uses POST to send
data) to log in.
= When the user is done, he/she logs out.
= When clicking back (a couple of time) the user eventually reaches
the page prompting for username  password

Problem: When the user hits refresh or forward, their magically  
logged in again.




What everyone else brought up is correct...

I just wanted to add -- are you sure that you're not running into a  
scoping issue, and reusing a login variable on the server side ?  a  
little mistake like that can be fixed by moving a 'my' from a package  
into a sub.


thats a common mistake that could result in that effect.  the other  
answers are much more specific to your problem.




// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

| Founder/CTO/CVO
|  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: DBI and threaded MPM

2007-07-09 Thread Jonathan Vanasco


On Jul 9, 2007, at 9:12 AM, Anthony Gardner wrote:

http://perl.apache.org/docs/2.0/user/performance/ 
mpm.html#Work_with_DataBases_under_Threaded_MPM


I'm looking into a problem we're experiencing (lots of netword  
connections) and I think the answer lies with Apache::DBI and the  
version of mod_perl we're using.


A few questions, does anyone know of the state of DBI::Pool?

If anyone is using threaded MPM and Apache::DBI, how are they  
dealing with sharing the the connection within the threads?


I'm looking at Thread::Sociable (preference) and threads::shared and

I'm looking for tips and/or defacto stds used at the time of writing.
Any tips would be great while I continue playing with threads and  
searching for other info.


Some people here ( not including me though ) are using connect_cached  
in DBI , and bypassing Apache::DBI altogether.  you might want to try  
that.
correct me if i'm wrong.. but i believe you want to not share dbi  
connections between threads.  wouldn't you need a factory class to  
toss you a fresh connect ?
if you want to do true connection pooling, you'd be best off with  
something like sqlrelay or pgpool.  the apache::dbi/dbi cached don't  
really pool; they just override connects for established connections  
on their process and reuse them.  things like sqlrelay/pgpool will  
let you use 50 db connections for 150 server processes ( by blocking  
a lot, yes )





// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

| Founder/CTO/CVO
|  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: header issues etc...

2007-07-04 Thread Jonathan Vanasco


On Jul 3, 2007, at 10:37 PM, Perrin Harkins wrote:

Using closures just makes it more confusing.  Class variables are
usually implemented as globals, i.e. our $object, not my $object.


agreed.

i just prefer using methods locked into version numbers for a  
consistent api.  this way the variable names can change, and the only  
way to get/modify vars is through the api methods.




// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

| Founder/CTO/CVO
|  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: Where to store uploads

2007-07-03 Thread Jonathan Vanasco


On Jul 3, 2007, at 10:38 AM, Clinton Gormley wrote:


I didn't mean: stick the file in the DB.

I meant, stick the file into a directory on a particular machine, and
then put this into the DB:
Sorry - I meant, store this in the DB:
 - ID:  1234
 - type:image/jpeg
 - path:12/34/1234.jpg
 - server:  images1.domain.com

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

server


i always do that... metadata in db and file on os

if you expect a large amount of files, you should do hash the file  
name and store in buckets


ie
$name= 'file'
$hash= md5($name);
	$path= sprintf( /%s/%s/%s/%s , $root, substr($name,0,2), $root,  
substr($name,2,4),$name );


you can't store by name alone because of character distribution among  
english words and numbers -- you'll end up with buckets that have 20k  
files and others that have 1.  md5 will give you a good distro in 32  
chars ( or bump to a higher base and show it in 16chars !)


if you're doing actual numbers, put in buckets working backwards --  
ie, by the power of 1,10,100 etc, and not reading frontwards.  you'll  
get more even distribution that way.


these are 2 mathematical principles... i can't remember their names.   
but they are good reads if you can find the names.  the irs uses the  
latter one for tax audits.


also keep in mind the os performance with files.  most os's do the  
best at ~1k files per directory; some are good up to 5k


md5 with base16 can give you a 3 deep directory  \d\d\d = 16*16*16 =  
4096 files
md5 with base32 can give you a 2 deep directory  \d\d = 32*32 = 1024  
files
md5 with base64 can give you a 2 deep directory  \d\d = 64*64 = 4096  
files


if only base32 were more common thats a good sweet spot.  for  
simplicity, i usually do 3 base16 chars.  but 2 base32 might be  
better for your os.



// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

| Founder/CTO/CVO
|  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: questions on serving big file SQL statement parsing

2007-07-03 Thread Jonathan Vanasco



On Jul 3, 2007, at 4:02 AM, Clinton Gormley wrote:


This last statement I have a quibble about : using mod_perl to handle
file uploads. I may be wrong here, so I'd welcome reasoned  
disagreement,

but the way I understand it:


not all file uploads, but large ones.  anything over 100k i won't put  
onto mp.


 - My image uploads require processing, so I need some form of Perl  
- I

   already have that available in mod_perl.


i'm doing that now.  i'm migrating all the image processing to python  
though.  the image resizing generated by python is way better ( speed  
is slightly better in python, but i'm actually worried about  
quality.  i'm not too happy with the way Imager resizes stuff, too  
many artifacts in resize+jpeg compression.  gd+image magick worked  
poorly re: resources.)


to handle it, i'm doing thumbnails in perl as-created and flagging  
the image in the db with a 'not processed' bool.  a persistent  
process queries the db and resizes the images in python.




 - The mod_perl processes aren't being kept tied up for a long period,
   because the proxy is handling the slow bit: the transfer.


i've had proxies break send off chunks when i've updated daemons.   
its annoying.



 - The only downside is that a large image upload plus processing
   could cause the size of the process to grow a lot, reducing the
   number of processes that you can run at once.

=snip

 - Keep your upload processing mod_perls on one box, so that if you
   are flooded with uploads, just the upload functionality on your  
site

   is taken out, rather than your entire site


thats my biggest concern.  you could stay on the same box and just  
create a sep. pool of mp servers for the upload proxies though... any  
sort of processing done within mp is at the expense of other mp  
servers.  if your page generation time is an avg .08 seconds , and  
you just did an image upload + resize that took 3 seconds to process,  
you cost yourself a bunch of resources that mp could have handled.


so let me clarify my earlier statement-- you don't want your main mod- 
perl app handling the uploads.  if you can push it off onto another  
mp process/server, thats ok.  but if its on your main server, you're  
just creating eventual problems- your authorization and general  
content generation will be competing for resources with processes  
that can take several seconds.  bad idea.



// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

| Founder/CTO/CVO
|  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: header issues etc...

2007-07-03 Thread Jonathan Vanasco


On Jul 3, 2007, at 5:51 PM, Perrin Harkins wrote:


I don't really understand this description.  If you're trying to code
a singleton pattern, use global variables to hold the object.  That
makes it clearer what your intent is.



Scoping works the same as usual under mod_perl.  If you need access to
object instances, you can use a singleton pattern, storing the objects
in global variables, or you can pass the instances to the sub that
needs to use them.


i prefer storing them as class variables and using a public method to  
provide access


ie:

package myfactory;
my $object= object-new();
sub get_object { return $object ;}
my %objects= (
'a'= object-new(),
)
	sub get_object_hash { my ( $class, $flavor )= @_; return $objects 
{$flavor} ;}


package myapp;
my $object= myfactory-get_object();
my $object_a= myfactory-get_object('a');


i can't remember if the $class is necessary or not.  i'm responding  
via my mobile :)




Re: questions on serving big file SQL statement parsing

2007-07-02 Thread Jonathan Vanasco


On Jul 3, 2007, at 12:21 AM, James. L wrote:


i probably should give more detail about my question.

in my case, i need to do authorization. do i need
extra mod_perl front-end server to do this? how does
this perform?

also, will serving the file from backend mod_perl
server to the front-end proxy a such bad idea? I am
thinking that the modperl server will spit out the
file to the proxy without have it tieup with the
upload and let the proxy handle the file upload. am i
right about this? ( couldn't find much detail on proxy
to back it up at this moment )


there was a discussion about Perlbal a few weeks ago on this list...

somone posted a case study, i think.  or a link  to one

from what i recall, perlbal will do a subrequest to a backend modperl  
server for auth, then handle the file upload itself.


you don't want to do any large file handling, or even general static  
file handling, under mp if at all possible.  let it handle content  
generation and authorization as the 'brains' -- thats what it does  
best.  use other apps like perlbal, nginx, whatever to handle your  
static files and large uploads.





// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

| Founder/CTO/CVO
|  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: apache and php

2007-07-02 Thread Jonathan Vanasco


On Jul 2, 2007, at 11:38 PM, Eli Shemer wrote:

I have installed mod_perl 1.3 statically to apache while using php  
as a DSO


After I've gracefully reloaded apache, php stopped working

What is the best way to get them both working together ?

Should I statically link php as well or do I have to use mod_perl  
as a DSO ?


there was some sort of library conflict between php/mysql/modperl a  
while back on a few distros.


i think the only way around it was to recompile everything from scratch.

generally speaking though... don't run mod_php and mod_perl on the  
same server.  you're just going to bloat apache and tie up resources.


i run nginx on port80 for static content, push php content to fastcgi  
and proxy certain urls to mod_perl.  my server's efficiency spiked  
drastically when i moved away from an all-apache setup.




// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

| Founder/CTO/CVO
|  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: Problems using Apache::Reload

2007-07-01 Thread Jonathan Vanasco


You're comparing Apples to Rocks with php  mod_perl ( rocks was the  
first non-fruit thing I could think of )


php has 3 main flavors - mod_php , php-cgi , php-cli

lets just look at mod_php and php-cgi

	if you run perl and php through a fastcgi proxy , you're going to  
get similar performance from an architecture standpoint.  each  
language will be a bit faster or slower depending on its strengh or  
weakness in whatever you test, but the overall design of the systems  
will be the same, and you won't see much of a difference.


mod_php and mod_perl sound kind of similar..


		mod_php is sticking a php interpreter in apache , and using that to  
process files
		mod_perl is sticking a perl interpreter in apache , and using that  
to process files ( it can script apache + integrate with hooks too )


	but they behave a little differently because of the way they have  
very different approaches in the way they handle memory - shared  
memory, loading libraries, copy on write, etc

they also have slightly different architectures

most people use mod_perl in dedicated environments -- it achieves its  
speed performance by compiling  caching code -- which eats up  
memory.  because code is handled with the package namespaces, people  
generally don't run it in shared environments, as you provide  
security from people overwriting namespaces can only happen by  
consuming more memory to create isolated namespaces in the children.


some people here may disagree with me and chime in...

	but i strongly advise not depending on mod_perl if you don't have  
'root' access for apache.  you're going to create a lot of headaches  
for yourself, and you're only going to be able to experience a  
limited subset of features  optimizations that are offered.  as a  
bad analogy, your experience with mod_perl is going to be like  
driving a sportscar around in a crowded parkinglot - you're stuck  
with a small speedlimit and you can't leave the lot and really see  
whats under the hood.


if i were in your situation, i'd do the following:
		1, try to get root access , so you can run/write handlers or  
registry stuff that won't depend on reload

2, look into your options with running perl via fast-cgi
		3, stick to php.  drop apache, switch to nginx and run php via fast- 
cgi , utilizing the APC cache ( or the eaccelerator one if its  
working again )


a while back I benched a simple app in php  perl, using the phptal   
petal libraries:

20 r/s - mod_php / Apache
150 r/s/ - php-cgi / apc / nginx
200 r/s - mod_perl

the huge speed differences between nginx and mod_php was due to:
a- nginx is faster/more lightweight, tied up less resources than apache
	b- apc cached the phptal templates  engines way better than the  
standard php stat or whatever it does.  i didn't bench rps under  
apache using apc and not, but the generation time went from .7  
seconds to .09 per page.   it was a HUGE difference on that alone.
	c- mp likely edged out php because perl is just kickass with text- 
processing, which is primarily what i benched.


that said, if you don't like perl - don't use it.  there are lots of  
ways to improve your php performance.


i still use php -- we have a lot of micro-sites and templates that we  
don't want to cache.  running that stuff in php lets us easily  
specify how much memory we want to limit that too , and keep it  
isolated from our main perl servers.  all of the db interaction on  
that stuff is handled by requests to internal perl-servers which  
return json objects.  its really gives us the best of both worlds.



On Jul 1, 2007, at 4:47 AM, Tony van der Hoff wrote:

On 30 Jun at 16:55 Jonathan Vanasco [EMAIL PROTECTED] wrote in  
message

[EMAIL PROTECTED]

[snip]
assuming you're on a nix/bsd -- you need to be able to restart the  
server.

if you can't , then you shouldn't be using mod_perl.

[snip]

Thank you, Jonathan, for your more detailed explanation. I have to  
say, I am
extremely disappointed with my experience. I've used PHP for some  
years to
create interactive web sites with some success, but having read  
about the
significant performance boost available from mod_perl, I bit the  
bullet, and
used PERL for the first time on my current project. Had I known  
then what I

know now, I wouldn't have bothered :-(

I don't even like the language much, but I'm sure that's a personal  
thing.


It looks then like I have two options:
1. abandon mod-perl and just use cgi.
2. move the project to a server over which I have full control.

(1) rather defeats the object of using PERL, and I am loth to  
acknowledge
defeat; (2) adds significant expense, and extra effort, to the  
project. Bah

- what a mess!

Thanks again, Tony

--
Tony van der Hoff| mailto:[EMAIL PROTECTED]
Buckinghamshire, England


// Jonathan Vanasco

Re: Problems using Apache::Reload

2007-06-30 Thread Jonathan Vanasco


On Jun 30, 2007, at 2:40 AM, Tony van der Hoff wrote:


Well, it is my intention that the modules should be reloaded if  
they've
changed; that's the whole point of using Apache::Reload, so I'm  
pleased it
works. Presumably, if they haven't changed, the only performance  
hit is a
stat to the file system, and then only on those modules which  
explicitly

call Apache::Reload. I think I can live with that :)


Thats the intention of the devel environment.  But aside from the  
performance hit, reload doesn't work perfectly.  some module changes  
won't get picked up due to class override / superclass conflicts,  
other changes will cause Reload to just crash your server.  when  
you're running reload, you're ideally having the stat and a clean  
reload -- in practice you can get larger performance hits from the  
stat being read wrong and tons of crashes.


However, without the ability to restart the server, and short of  
renaming
the files, how should I update my software? It won't happen much at  
the
production end, but it will certainly happen. Shouting Never,  
Never, Never
is all very well, and undoubtedly good advice, but it's a bit  
impractical

without an alternative.


assuming you're on a nix/bsd -- you need to be able to restart the  
server.  if you can't , then you shouldn't be using mod_perl.   see  
if you can run apache on a port you can control, then proxypass to it.
mod_perl does a lot of performance/memory optimizations by using the  
copy-on-write model for vars and caching compiled subs.  when you  
'reload' code, you're just redefining the subs... which means they  
get unshared.


illustration
start   parent-a
forkchild-a child-a child-a
update code
reload
child-a child-a child-b
child-a child-b child-b
child-b child-b child-b
	i'm not sure how reload affects the master-process memory--  but I  
have a funny feeling that new children will spawn with the pre-update  
code, then stat to the new  code




What are the other problems you refer to? I've been lurking on this  
list for
some months, but have not seen anything mentioned, and Google  
doesn't throw

up anything on the first few pages.


look back within the past 18-6 months.  there was a lot of reload  
talk then.  not as much lately.


also, you should never do an apachectl restart/graceful.
you want to do a full apache stop,  and then apache  start.  the  
integrated restart command will essentially cause a memory leak ( its  
not really leaking, but the memory isn't recycled/overwrriten -- so  
your process will double on size the first restart, etc etc etc )




On Jun 30, 2007, at 6:13 AM, Clinton Gormley wrote:

With regards using Apache::Reload in production, my understanding is
that, while Apache::Reload is really useful for development, there are
edge cases where things get messed up, and which require a stop- 
start to

get them working again.  And for this reason, we would not usually
consider using this module in production.


its much less edge-cases than it is use-cases.



// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

| Founder/CTO/CVO
|  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: Problems using Apache::Reload

2007-06-29 Thread Jonathan Vanasco


On Jun 29, 2007, at 1:24 PM, Tony van der Hoff wrote:
So, sorry to have rambled on a bit, but does anyone have any  
suggestions as
to how I can properly fix these problems, or tell me what I'm doing  
wrong.

Any advice will be very welcome.


I don't have time to analyze your config, but

you should NEVER run Apache::Reload in a production server.

NEVER

NEVER NEVER NEVER.




// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

| Founder/CTO/CVO
|  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: Problems using Apache::Reload

2007-06-29 Thread Jonathan Vanasco


On Jun 29, 2007, at 4:09 PM, Tony van der Hoff wrote:

Well, thank you for that advice.

Um, Why?

How does that help solve my problems?



Apache::Reload checks perl modules and *reloads* them on every hit if  
they've changed.  It's essentially saying hi, i'm running under a  
persistant environment , where code shouldn't be changing, but I'm  
going to take a performance hit each time.  you get a perfomance hit  
AND you start to lose memory ( stuff goes from shared to unshared )


it also performs very awkwardly and has been the cause of numerous  
problems on this list.   its likely not the culprit of the problem  
you're seeing now, but it will be causing many issues down the road.   
its not meant for production, its geared for dev servers.



// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

| Founder/CTO/CVO
|  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: [mp2] Apache2::Reload doesn't reload

2007-06-27 Thread Jonathan Vanasco


I've found Reload to work poorly on the handler sub -- i haven't been  
able to figure out why, but it just works poorly.


To get around that, I just have the handler call/wrap other subs.


package myapp;

sub handler {
$page= myapp::Page-new();
$page-whatever;
}


any changes go into myapp Page, or other modules.

i never have to worry about the reload issues on the handler.  pretty  
simple.








// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

| Founder/CTO/CVO
|  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: Config::Loader and HTML::StripScripts

2007-06-26 Thread Jonathan Vanasco


On Jun 26, 2007, at 11:09 AM, Clinton Gormley wrote:


allowScriptAccess=never
allownetworking=internal



I don't know what those are :)

object tags are removed by default, and you would still need to
subclass HTML::StripScripts in order to allow those elements.

The Rules (for safety's sake) are applied after the standard  
parsing has
already happened, and object's are not allowed because they are  
just too
risky. So if you want to do that, subclass the WHITELIST  
INITIALIZATION

METHODS and add the relevant config in there.


already doing that...

those are placed in object AND embed tags (i don't recall if embed  
are off by default)
regardless, it might make sense to mention them in the docs as  
they're in a grey-area and something to be wary of when enabling  
objects.


allowScriptAccess locks the flashplayer down- it can't call any js  
functions or do any document writes/etc.  without it, its possible to  
have a .swf file that onload starts rewriting the page to load in  
external js files and then write them into the document body (thereby  
avoiding any js xss safeguards).  thats how a lot of old 'skinning'  
and 'tracking' was done - people would write mini-apps hiddin in a  
1x1 swf file that would manipulate the dom and do whatever data  
exchange is needed.  it can be pretty insidious.


allowNetworking, i think, disables what getURL can do.  i could be  
wrong on that one, but i believe that is the command that locks down  
what swf files can redirect browsers to ( same domain as html or any  
or none )



// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

| Founder/CTO/CVO
|  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: opinions of mod_perl users on MIME email sending

2007-06-22 Thread Jonathan Vanasco


On Jun 22, 2007, at 12:52 PM, Clinton Gormley wrote:


Of course.  My daemon wrapper code checks if that particular job is
already running, and if so skips it.  If the job is still running  
after

the Nth skip, it sends me a warning email


awesome.  that solves just about any problem you can have.


Why are you using DB locking for such long periods?  Almost none of my
code requires locks, and if there is something that DOES require a  
lock,

I lock, transform, unlock, making sure that the transform process is
quick.


i'm not on on purpose :)

but bugs happen, and when they do-- their effects end up looking like  
that.



// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

| Founder/CTO/CVO
|  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: opinions of mod_perl users on MIME email sending

2007-06-22 Thread Jonathan Vanasco


On Jun 22, 2007, at 4:13 AM, Clinton Gormley wrote:

Disadvantage:

 - you can wait for up to a minute before the mail gets processed.
   Although, with Schedule::Cron, you can schedule jobs every second


you should write something into the first-line of the code that looks  
to see if there's a job already running; and quits if there is.


the issue with that approach is that db blocking and long jobs can  
leave you with 1,2,3,4,5,6,7,etc cron jobs ; and your box eventually  
crashes


thats what happened to me, and why i just went for a persistant  
daemon.  damn db locking issues.



// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

| Founder/CTO/CVO
|  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: opinions of mod_perl users on MIME email sending

2007-06-22 Thread Jonathan Vanasco


On Jun 22, 2007, at 1:24 PM, John ORourke wrote:
The database idea has some good uses - I run 120 shop sites and of  
course they're constantly sending out account confirmations, order  
updates, etc.  Currently there's no way of easily tracking what  
happened to an email or finding out when, for example, hotmail  
decides to completely ignore a password confirmation request.  If  
each email (or a representation of it) were stored, a status field  
could easily be updated by something processing the mail server logs.


Of course, all that could be wrapped up as one of several email  
sending methods.


you could put a guid in the email headers, and log that to the  
database along with metadata about the message sending.
if the message bounces, or there's an error at the mta level, you'll  
get the guid back.  you could do it in the message body too, but  
thats messy to the user.


some smtp servers will give you their own guid for the message if you  
set stuff up right-- but thats not standard across systems.





// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

| Founder/CTO/CVO
|  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: opinions of mod_perl users on MIME email sending

2007-06-21 Thread Jonathan Vanasco


On Jun 21, 2007, at 4:21 PM, Frank Wiles wrote:

I have a framework similar to TT and the like, so I'm thinking of
creating something like the above module which handles all the
Unicode stuff, and which allows subclassing for use with different
templating systems and frameworks.   Something like
Mime::Lite::Template::your_framework_here

I've finally sorted myself out with a PAUSE account so I'll be
scouting around for the ideal namespace at some point.  I'll be
discussing off-list with Jonathan Vanasco so do butt in if you're
keen to contribute.


  Yeah that's a good idea, put in hooks for HTML::Template, Mason,
  etc.


hooks are good.  setting up a filterchain might be better.

i don't like the idea of having templating frameworks involved with  
mail-- they have huge overheads.
some sort of lightweight filterchain or something that can call in a  
framework if-needed would be optimal.





  Well I wasn't talking about another MP process, just a standard
  Perl daemon maybe using something like the Net::Server framework.

  Or if the timing isn't terribly important, just have your
  mp code shove the message into a db table and have a cron
  pick them up and send them off in the background.

why not just pipe to exim/postfix/qmail?

you could also do a twisted daemon really quickly.  i know this is a  
modperl list-- but the twisted framework works really well for this  
stuff.  you could code a custom mailserver in an afternoon .


// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

| Founder/CTO/CVO
|  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: opinions of mod_perl users on MIME email sending

2007-06-21 Thread Jonathan Vanasco


On Jun 21, 2007, at 5:36 PM, Frank Wiles wrote:


  Off the top of my head? So you can centralize your SMTP
  onto on system if you have multiple servers in the mix. But
  that's what MIME::Lite and friends do if you don't specifically
  tell it to use a remote system.


ok.  relaying to a local server for actual delivery makes a lot of  
sense.




  Yeah I've seen some neat twisted stuff, POE might be a reasonable
  alternative in the Perl space.


POE is pretty neat.  I haven't played with it much, but i liked it.

I've done a lot of twisted stuff in the past , so its very natural to  
me.  I brought it up over POE though  , because it ships with an smtp  
server built in - you really just need to customize the callbacks,  
and you're good to go.


if you get a chance to flip through the twisted o'reilly book at a  
bookstore, i recommend checking it out.  programming an occasional  
python app really keeps my perl coding style in check.




Re: Howto develop with modperl 2 ? (Restart Apache all the time ?)

2007-06-19 Thread Jonathan Vanasco


On Jun 19, 2007, at 10:59 AM, Lionel MARTIN wrote:


You can put that in your Apache conf file:

PerlModule Apache2::Reload
PerlInitHandler Apache2::Reload

This way, every time you alter one of your Apache modules, it gets  
reloaded.


This incurs a small performance hit (the server has to fstat the  
related files every time a request is run, to know if any module  
has been updated on disk), but that's definitely a good choice when  
developing (no need to restart your server)



Just to add:

this can screw up class inheritance
given
b isa a
sub a::one
sub b::one
issue:
			if you delete b::one, you'll get an error under apache::reload.   
you'll need to restart the server


also

	some modules, like rose::db::object, do some very agressive  
optimizations and setup that have to do with package namesapce, and  
are only run at begin.  if you alter their subs/vars/constants,  
you'll need to restart as well.


Apache2::Reload is the way to go.. but there are situations like the  
above to watch out for.


I'm sure there are other situations out there too.  those are just  
the ones i deal with daily.




// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

| Founder/CTO/CVO
|  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: apache version check

2007-06-18 Thread Jonathan Vanasco


On Jun 18, 2007, at 12:33 PM, _spitFIRE wrote:

  When I don't know where apache is installed, how do I do this? I  
was asking
for a way to write a perl script that would give me the version of  
apache

installed, if possible!


then why did you specifically ask for a way to do it on the command  
line without loading mod_perl ?


`httpd -v` is the correct approach.

honestly, your two questions make no sense in context of one  
another.  why don't you tell us what you're trying to accomplish-- in  
the big picture.


if you're not running something under mod_perl, you're going to have  
to run a script that figures out which httpd would be called.   
remember, you can install 1,2,100 different versions of apache in  
different places.  you need to figure out which one would be right  
( try using find to get them all, or which for the default for your  
user's env )


then just call `httpd -v` from a perl script as a shell command, and  
trap the output.  i forget the name of the app that does that...  
ipc::run ?





// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

| Founder/CTO/CVO
|  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: opinions of mod_perl users on MIME email sending

2007-06-18 Thread Jonathan Vanasco


On Jun 18, 2007, at 11:51 AM, John ORourke wrote:


Hi folks,

I'm wondering what modules people use for sending email?  At the  
moment I'm using MIME::Lite but I'm doing several things myself  
which a bigger module might do for me:


- header encoding - I can't find any modules which will Q- or B- 
encode headers that have the UTF-8 flag set


- UTF-8 detection on the body to set mime type

- sending with feedback - I'm using Net::SMTP so I can capture  
result codes and give a variety of error messages instead of just  
'failed'.  Currently the biggest prob with this is potentially  
delaying page delivery due to timeouts.


cheers
John



John-

	I use a custom module, but don't use any of the MIME stuff or UTF8 -  
though I want to migrate.  My module is very barebones, but fast  
enough.  if you'd like to collaborate on a solution, maybe that could  
be a starting point.


	In any event, I STRONGLY suggest dropping the Net::SMTP option.  You  
WILL delay page delivery, and consume mp resources.   you also open  
up your system to a DOS vulnerability -- a malicious person can  
tarpit/teergrube mess with your server by having an email sent to a  
machine that only accepts 1byte a second, and continually asks for  
retransmission.


I always have mp pass stuff off to exim which handles all delivery.
to handle errors, you have 2 choices:
		a- look at the python mailman distribution, which has config- 
patches for all the popular mail systems , to do the receipt/ack/ 
error post-processing.
		b- configure exim via an embedded perl interpreter ( exim has  
mod_perl for its mta!  mod_python too! ), and just log the messages  
you analyze to sql.



	email isn't instant.  servers can be busy, servers can be  
unreachable.  let your MTA handle that.  don't do that in mod_perl.


// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

| Founder/CTO/CVO
|  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: apache version check

2007-06-18 Thread Jonathan Vanasco


On Jun 18, 2007, at 5:05 PM, John ORourke wrote:



   $version = ( $ENV{MOD_PERL_API_VERSION}==2 )?2:1;


that won't work, because that requires mod_perl to be loaded.

the original poster said:

	How do I check what version of Apache is installed from command  
line (without using/lodaing mod_perl)?


and then said:

	When I don't know where apache is installed, how do I do this? I  
was asking for a way to write a perl script that would give me the  
version of apache installed, if possible!


since its command line, he needs to figure out which apaches are on  
the system, and then test the versions on them.  there's no other way.


Re: TIPool

2007-06-16 Thread Jonathan Vanasco


On Jun 16, 2007, at 11:13 AM, Perrin Harkins wrote:


300 is nothing for MySQL.  You should be able to handle a few thousand
on a machine with enough RAM.


agreed.  MySQL connections are cheap.  Postgres ones consume RAM and  
kernel resources, and more than 50 sucks on a box.



If you already have a frontend proxy, you shouldn't have a lot of idle
servers holding db connections.  Assuming that your application uses
the database on every mod_perl request, only processes that are
actually sleeping will not be using their connection.


you can also look for db proxies/pools

i use/used pgpool , because i only use pg

i tested out sqlrelay a while back on mysql, and it seemed great

http://sqlrelay.sourceforge.net/



Re: TIPool

2007-06-15 Thread Jonathan Vanasco


how about some case-specific information about your request:

	why exactly do you want a pool of db handles, vs additional db  
connections ?

what db are you using ?

depending on your design and platform, a dbpool might not be a good  
idea -- or you could be best-off with a middleware dbpool.  for a  
while i was using pgpool , which is an intermediary server to pool pg  
connections.  i had 60 connections to pgpool, and 40 connections from  
pgpool the db.  but then i got 2 gb more ram, and didn't need it.





// Jonathan Vanasco

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

| CEO/Founder SyndiClick
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -

| 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: which module for this purpose?

2007-06-14 Thread Jonathan Vanasco


On Jun 14, 2007, at 11:53 AM, Jen mlists wrote:

Yes I did also consider using mp2.But when I searched on this list and
found many guys mentioned they install/run mp2 unsucessfully,so I
picked the easy way of mp1.:-)


Thats not the easy way, thats the hard way...  just install mp2 and  
save yourself further headaches.  the people who have issues with mp2  
either have platform issues with building it which this list will  
fix, or have just as many problems with mp1.


A very confusing thing about mod_perl, and what often gets me, is  
that when you return OK or forbidden from a phase, you're not  
necessarily returning that to the client -- you're just returning it  
to apache chain.  so if you return OK from a auth check, you didn't  
send an HTTP_OK to the client, you just sent ok to apache, which  
moves on.  or forbidden which will stop and then send an  
http_forbidden.  the internal apache codes + http spec / to-client  
codes are similarly named as they have nearly identity functions.


Based on your design constraints, I have two guesses on what you're  
building.
	a- you're doing some sort of design/agency thing where you need to  
authorize clients
	b- you're doing some sort of web porn download service, where you  
need authorize customers and keep the file names from floating around


with that in mind, in addition to the auth handlers, i'd also look  
into transhandlers-- where you can map urls / files to whatever you  
want.

you can also play with something like this...

$self-PageUser-ApacheRequest-content_type('text/calendar');
	$self-PageUser-ApacheRequest-err_headers_out-set(Content- 
Disposition =inline; filename=${filename}.cal);


which will let me turn a http://calendar/path/to/091231jhh?1238u13  
into whatever i want for dynamic content.



// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

|  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::Request install

2007-06-13 Thread Jonathan Vanasco


On Jun 13, 2007, at 5:44 AM, Jeff Pang wrote:


When I installed Apache2::Request (without make test) and rut it I got
the errors:


at the risk of stating the obvious...

what happens why you run make test ?



// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

|  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::Request install

2007-06-13 Thread Jonathan Vanasco


On Jun 13, 2007, at 11:52 AM, Jeff Pang wrote:


It said I was making test with root identify,but Apache would be  
run as nobody.So in the source dir,I do chown -R nobody:nobody .  
and re-make test with root and nobody,but both still got failed.


I run MP1 with Apache::Request well for long time.But couldn't  
upgrade to MP2 and Apache2::Request.:(


apache drops to nobody, so thats fine.

what was the error ?  why did it fail ?



// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

|  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
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -





libapreq: end of file error, discard body request, and more fun

2007-06-13 Thread Jonathan Vanasco


i'm in a weird situation...

if i do this:

	my	$apr= Apache2::Request-new( $r , %{$self-URI_get_defaults( $r- 
uri )} );

$r-discard_request_body;

everything works fine in one webapp, and i don't have to deal with  
weird stalls when an overlimit amount of data is posted.


however, in a nearly identitcal webapp (both custom framework, no  
mason, straight calls to libapreq ), that generates a 'End of file  
found' error, and I have no get/post data.


now if i just do this..
# $r-discard_request_body;

then i can access the data fine -- but i'll get a weird stall when an  
overlimit amount of data is posted


does anyone have an idea how i can better test this to figure out wtf  
is going on ?


// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

|  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: [mp2] The right way to use CGI parameters in a handler

2007-06-11 Thread Jonathan Vanasco


On Jun 11, 2007, at 4:29 PM, Colin Wetherbee wrote:

That sounds good to me.  I'm not looking for any particular  
backward compatibility, and speed is an issue.


last i checked the speed difference is negligible.  its 'more proper'  
to use libapreq, and if you're doing things in term of mod_perl  
handlers (ie, not anything that would run as a std cgi ), then  
there's little reason to use  otherwise.




As I said in my original post, I tried to use Apache2::Request, but  
after creating that object, I couldn't print anything anymore.   
Perhaps someone could give me a hint on how to implement it?


could you print beforehand?

'print' might not be tied to the same output.

this might not be right based on your compile.

print 'foo: ' . $cgi-param('foo') . br /\n;


try:
$r-print( 'foo: ' . $cgi-param('foo') . br /\n );




// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

|  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: MP2: Patches for two problems under OpenBSD

2007-06-09 Thread Jonathan Vanasco


On Jun 9, 2007, at 2:22 PM, Simon Bertrang wrote:
The second thing i found was a missing character for a function  
name in

Apache2::SizeLimit (bsd_size_check - _bsd_size_check):

$OpenBSD: patch-lib_Apache2_SizeLimit_pm,v 1.1 2007/06/09 17:55:01  
simon Exp $

--- lib/Apache2/SizeLimit.pm.orig   Sat Jun  9 19:20:50 2007
+++ lib/Apache2/SizeLimit.pmSat Jun  9 19:20:59 2007
@@ -70,7 +70,7 @@ BEGIN {

 # will getrusage work on all BSDs?  I should hope so.
 if ( eval { require BSD::Resource } ) {
-$HOW_BIG_IS_IT = \bsd_size_check;
+$HOW_BIG_IS_IT = \_bsd_size_check;
 }
 else {
 die you must install BSD::Resource for  
Apache2::SizeLimit  .


Beat you to reporting that one ;)  Phillipe Fixed it in revision  
533265 on April 27, 2007 7:54:38 PM EDT


have you found the numbers reported by Apache2::SizeLimit to seem  
correct under openbsd ?
i use it under freebsd, and something seems off.  i haven't touched  
it in a while , but I was really apprehensive of the numbers reported.


Re: MP2: Patches for two problems under OpenBSD

2007-06-09 Thread Jonathan Vanasco


On Jun 9, 2007, at 2:48 PM, Simon Bertrang wrote:


Doh, sorry for not checking the archives.


i don't think anyone minds.


Uhm, good question... i dont know.  It's `just working' with another
application but i'd be happy if there's some better way to proove it.


i use it under freebsd, and something seems off.  i haven't touched
it in a while , but I was really apprehensive of the numbers  
reported.


But isn't that a question of BSD::Resource anyway?


probably, yes.  i'm just wondering if you feel trusting of the  
numbers of all that under openbsd.   i'm under freebsd, and question  
them.





// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

|  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: Odd difference between restart and stop - start.

2007-06-08 Thread Jonathan Vanasco


Krist-

NEVER do an apachectl restart under mod_perl .

there's a known memory leak on that -- the master doesn't give up the  
memory.


you always want to do a full stop then start.

if you want to do neat stuff with switching up ports, take a look at  
nginx.  one of the best features ive seen, is its ability to bring up  
a 2nd server on port 80 that uses a new config--


so you

nginx_a::80- apache_a::8000
launch apache_b::8001
nginx_b - apache_b::8001
( nginx proxies to old  new config )
stop nginx_a

completely seamless, and completely awesome.


On Jun 8, 2007, at 5:12 AM, Krist van Besien wrote:


Hello all,

I use mod_perl's perl sections quite intensively so that I can have
one config for all our webservers, and so that I can change some
settings easily using variables. I recently noted however that perl
sections are treated differently when doing a restart (httpd -k
restart) than when doing a full stop and then a start.

Let's illustrate this with a snippet form my config:
(I've removed most of the config, and only kept the bits I think  
are relevant)


perl

if ( $ENV{SWITCH} eq test ) {
   $backend = testserver ;
   } elsif ( $ENV{SWITCH} eq prod ) {
   $backend = prodserver ;
  } else {
   $backend = devserver ;
   }

$backendurl=http://; . $backend . :8080/app;
print STDOUT backend url is $backendurl\n;

push @PerlConfig, split (\n,  EOF);

Listen 8080
Listen 443

NameVirtualHost *:80

VirtualHost *:80

# define servername and other virtual host directives here.

RewriteRule ^/app/(.*)\$http://$backendurl/\$1 [P]

/VirtualHost

EOF
/perl

The idea is that before I start the apache server I can set an
environment variable SWITCH to either test prod or nothing, and
have the server forward incoming requests to different backends. To
have some feedback I have the server echo what it is going to use as
bacendurl.

Here is where it starts to get odd.

When I set the environment variable SWITCH to eg. prod and start the
webserver it will output the following to the terminal:
backend url is http://prodserver:8080/app;
and requests are properly proxied to the production server.
So far so good. It is behaving exactly as expected.

When I then set SWITCH to test and do a server restart, using
httpd -k restart
I get the following output:
backend url is http://testserver:8080/app;
but, and this is the odd thing, the server keeps forwarding requests
to the production server. I exepcted it to start redirecting to the
test server.
From the output I get it is obvious that the perl section gets
executed. But it is as if the @perlconfig that is created is ignored
during a restart.

When I do a httpd -k stop followed by a httpd -k start I don't have
this problem. Then everything performs as expected.

Why is this?

Krist

--
[EMAIL PROTECTED]
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?


// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

|  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: Replacement for CGI.pm escape and unescape

2007-06-07 Thread Jonathan Vanasco


On Jun 7, 2007, at 9:57 AM, cfaust-dougot wrote:


Hi All,

I'm running the latest mp2 with Libapreq.

Is there some method to duplicate CGI.pm's escape and unescape  
methods? I found escape_path, but obviously that isn't the same  
thing. I'm trying to remove CGI.pm from all my code and these are  
the last 2 things I need to take care of.



I use URI::Escape

 http://search.cpan.org/~gaas/URI-1.35/URI/Escape.pm

its small, and comes in the std perl distro




Re: Apache Startup

2007-06-07 Thread Jonathan Vanasco


On Jun 6, 2007, at 10:19 AM, Anthony Gardner wrote:

The problem is, I have startup.pl being run twice when it's only  
declared once in a .conf file which is Include(d) into httpd.conf.


there's a section in the docs about the apache startup cycle...

essentially, apache starts without binding to STDOUT/STDERR to make  
sure that it can start..  then it automagically shuts down and  
restarts going through the whole process again.







// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

|  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: asynchronous perl authentication!?

2007-06-07 Thread Jonathan Vanasco


On Jun 7, 2007, at 10:52 AM, _spitFIRE wrote:


Hi Adam,
  You are perfectly right. However, I'm in dire need of a Ajax  
style login.

Do you have any clue on how to go about implementing the sytem?



just do an xmlhttprequest to your auth script.
have it redirect to a page that prints 0 if there is no login, 1 if  
they are logged in

then have your js handle reading the var.  its simple.


// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

|  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: Replacement for CGI.pm escape and unescape

2007-06-07 Thread Jonathan Vanasco


On Jun 7, 2007, at 10:32 AM, Michael Peters wrote:
Good for URI escaping, but that's not the same thing as HTML  
escaping, which is

what CGI's escape/unescape do right?


oh, my bad.

then the module is  HTML::Entities







// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

|  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: asynchronous perl authentication!?

2007-06-07 Thread Jonathan Vanasco


On Jun 7, 2007, at 12:23 PM, [EMAIL PROTECTED] wrote:

Look at the control flow of Apache AuthCookie module and let me  
know if it can be done!
http://search.cpan.org/~mschout/Apache-AuthCookie-3.10/lib/Apache2/ 
AuthCookie.pm


The control flow shouldn't matter-- if its doing a redirect based on  
the result as someone else chimed in, you just need to catch that via  
javascript.


you'd probably be better off with a custom auth system though -  
they're not hard to make.


// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

|  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: Replacement for CGI.pm escape and unescape

2007-06-07 Thread Jonathan Vanasco


On Jun 7, 2007, at 2:47 PM, Ronald J Kimball wrote:

CGI's escape/unescape do URI escaping.  CGI's escapeHTML and  
unescapeHTML

do HTML escaping.


Thanks for the clarification.

In my circle of friends/colleagues, we've always referred to URLs as  
escape/unescape and HTML as encode/unencode


// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

|  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: Which template engine is best to create a perl site

2007-06-06 Thread Jonathan Vanasco


On Jun 6, 2007, at 10:34 AM, Tina Müller wrote:

well, many people say, why optimize code if the database is slow  
anyway.
i don't like that. if you can optimize by using a fast module - why  
not?

and by the way, JIT doesn't have many features, while HT::Compiled has
the dot syntax.


Well with this sort of system, it makes sense to optimize the code --  
either way you're using the same templates.  Easy choice.


But simply choosing 'the fastest' templating system isn't always the  
best idea -- it can ,and often does,  lock you into a templating  
system that can be extremely hard to migrate from in the future.


I'm not a fan of disregarding db blocking when you optimize -- you  
should always go for the best/fastest possible route.


When i looked at Petal, which was slower than many of the other  
engines, the speed difference was rendered negliblle when measured  
against the db blocking.
i could have chosen a faster engine, but the speed wouldn't have  
mattered much in context, and I wouldn't have the portability that  
Petal offered me.

So i went with petal, then optimized elsewhere.


// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

|  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: Weird problem - local variable appears to be available in 2 instances of mod-perl

2007-06-05 Thread Jonathan Vanasco


Steven-

Variables in mod_perl are persistant - you need to make use of 'my'  
to reinitialize the variable on each suroutine call


look for 'scoping' in the docs.  there are several sections.

consider the following,  which is very likely what you have

package handler;
my $world;
function hello {
$world += $_[0];
return hello, $world;
}
1;

$var is initialized when the module compiles (startup), but  each  
invocation of test() just concatenates a new value to $var.

hello('world') - hello, world
hello('world'); hello('universe'); - hello, world , hello,  
worlduniverse


you want to be doing

package handler;
function hello {
my $world;
$world += $_[0];
return hello, $world;
}
1;

the problem seems intermittant, because the variable is kept  
'initialized' in the parent and then cloned to the children via copy- 
on-write.  every time a new apache process is spawned, it has a  
fresh  intialized variable (so you see no issue).  you only notice  
the issue when a processess serves its second or later request.







It is appearing/disappearing most likely because eac

On Jun 5, 2007, at 7:28 AM, Steven Heimann wrote:

I am new to mod_perl but have been using perl over the years for  
various

text processing needs.

I needed to extract and modify data on the fly for our web site and
thought mod_perl would be perfect.  The Ubuntu Breezy package
installation worked fine and mod perl seemed to work correctly.

The links on the web page call a perl script to open an xml file,
process and extract data in the file and produce HTML.  It appears to
work correctly except that in testing on odd occasions some data  
from a

previous call to the perl script gets displayed.  It is not the whole
page.  A paragraph from the previously accessed page will get  
displayed

along with the current page.  This paragraph of text represents the
contents of one variable in the perl script.

Continual refreshes from the browser results in apparently random
appearance of the same incorrect data.  I am testing with direct  
access

to the web server (apache2) to ensure it is not caching causing the
problem.

I don't understand how intermittently a variable seems to be  
persisting

from one instance of the script to another, especially when during the
course of several refreshes it will disappear and then reappear.

I have been trying to find an answer for much of the day without
success.  Any suggestions of how to track down this problem would be
appreciated.

Thank you and regards
Steven




Re: how to implement input filter for easy way?

2007-06-05 Thread Jonathan Vanasco


you should be able to do that with a simple redirect, apache1 or 2

look up mod_rewrite or modrewrite

you don't need perl to do that, and since you're running php in  
apache, i would recommend against it .



On Jun 5, 2007, at 8:41 AM, Max Rodkin wrote:


Hi all,
i need to convert request:
$355632000166323,1,1,040202,093633,E12129.2252,N2459.8891,00161,0.010 
0,147,

07*37!
into:
GET
/main.php?str= 
$355632000166323,1,1,040202,093633,E12129.2252,N2459.8891,00161,0.0100 
,147,

07*37!  HTTP/1.1
Host: localhost
as i understood, it`s possible in several ways:
1.RequestHeader Directive , apache2 only.
2.Multiprotocol Support
http://perl.apache.org/docs/2.0/user/handlers/protocols.html  ,  
apache2 only

3.Apache Module mod_headers , apache2 only
i know it in theory only, and have no enought skills in apache
administration/perl coding.
Please, show me best practice way to solve my question.
The my hosting phpinfo information:

  Apache Version  Apache/1.3.34 (Unix) mod_fastcgi/2.4.0 PHP/4.4.0
mod_deflate/1.0.21 rus/PL30.22
  Loaded Modules  mod_fastcgi, mod_php4, mod_deflate, mod_auth,
mod_access, mod_rewrite, mod_alias, mod_userdir, mod_actions, mod_cgi,
mod_dir, mod_autoindex, mod_include, mod_info, mod_status,  
mod_negotiation,

mod_mime, mod_log_referer, mod_log_agent, mod_log_config, mod_env,
mod_charset, http_core

Respect, Max Rodkin






// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

|  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: mod_perl, html forms and unicode/utf-8

2007-06-05 Thread Jonathan Vanasco


On Jun 5, 2007, at 12:56 PM, John ORourke wrote:

  my $q=Apache2::Request-new($r);
  my $known_to_be_utf8 = $q-param('test'); # form post doesn't  
give charset, none assumed



slightly off topic, my suggestion on implementation would be along  
the lines of this:


package Context();
sub new(){}
sub getPost{}
sub getGet{}
sub getGetPost{}
1;

where you have a Context class.  instead of calling $q-param ,you  
call $ctx-getPost


Context does two things:
a- it encapsulates all of the charset crap, so you only write it once.
	b- it gives you a uniform access to a few apache::request and cgi  
functions.  this way you can switch between the two as needed.


i switched to that a few weeks ago.  i think randy has a cpan module  
that is similar.


its a damn lifesaver though.  i took a negligible hit in wrapping all  
my get/post in that, but all of my data santization routines are  
right there in that module.  (strip whitespace, strip charsets i  
don't want, etc )


( i actually double wrapped it -- class: Context gives me a wrapper,  
class MyApp::Context subclasses Context and overloads the getpost  
with custom sanitization routines per app ).






Re: Which template engine is best to create a perl site

2007-06-05 Thread Jonathan Vanasco


On Jun 5, 2007, at 2:54 PM, Perrin Harkins wrote:


I think that's a pretty questionable claim.  TT is faster than
CGI::Ex::Template in normal use with mod_perl.  CET is only faster if
you use mod_cgi where TT can't do caching.  HTML::Template::JIT
compiles your entire template into a C program, so it's hard to
believe that anything else is going to be significantly faster than
that.

At any rate, all of the templating tools discussed so far are more
than fast enough to build a large scale site with.


I didn't know that... I had read many things that CET was 'the way to  
go' if you were using any of those packages.  I like how it really  
just redoes all the backends, so you can switch languages.


anyways, here comes my monthly dose of heresy:

Personally,  I only use TAL now, namely via the Petal distribution.

I realized that the biggest issues I had with scaling and performance  
were with certain bottlenecks that had a lot to do with the actual  
strengths and weaknesses of perl, and not necessarily my code.   
( this is aside from db blocking issues )


When it came to crunching number matrices in analytics,  image  
processing, or handling large file uploads -- perl and mod_perl  
couldn't rise to my needs.Perl is heaven with strings -- but its  
hell with math, CPU and memory use go too high , as does execution  
time.   The image resizing quality on Imager, GD and ImageMagick were  
all pretty bad ( i thought ) regardless of the quality settings --  
and took far too long.  MP just isn't good at large file uploads -  
too much memory gets lost.


The result I found was to use TAL templates via Petal... and other  
languages where they seem fit.
Whenever I run into a math-intensive page or for newer image  
processing work, I offload that via the proxy server, onto a  
TwistedPython or ModPython server.  Whenever I need to handle large  
file uploads, or offer a page with templates that are not cached in  
memory ( HUGE CONCERN under mp)  I have php via fcgi standing by.


in many situations, i can use almost the same exact code/logic -- it  
just takes a few minutes to port a section of an app to another  
language / framework better suited for it.  the difference is often  
by a factor of 10-100: pages taking .1 seconds under the python  
interpreter where perl needed 1-10; or php spooling the upload to  
disk better, without memory concerns.


With TAL, I don't have to worry about anything on the view side.  I  
just call each page with a standard hash/dict/array/whatever -- i use  
the same exact template files, i even call them from my perl document  
tree!


None of the other templating systems offered that flexibility.  They  
all have their own charms though-- TT and Mason are almost  
application frameworks more than they are templating libraries.


Re: Failed to resolve handler

2007-06-04 Thread Jonathan Vanasco


On Jun 4, 2007, at 11:08 AM, Gustavo Schroeder wrote:


startup.pl content:

#!/usr/bin/env /usr/local/bin/perl
use Authen::Simple::NIS

Error presented:
[Mon Jun 04 07:56:38 2007] [error] /usr/local/apache2/conf/startup.pl
did not return a true value at (eval 2) line 1.\n
[Mon Jun 04 07:56:38 2007] [error] Can't load Perl file:
/usr/local/apache2/conf/startup.pl for server cabal:0, exiting...

thoughts?



append startup.pl with


1;


it needs to return true ( return 1 ) like a standard perl module/package

// Jonathan Vanasco

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

|   CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -

|  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
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -





  1   2   3   4   5   6   >