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

2007-06-07 Thread Tina Müller


On Thu, 7 Jun 2007, Perrin Harkins wrote:


On 6/6/07, Tina M=FCller [EMAIL PROTECTED] wrote:
 well, many people say, why optimize code if the database is slow anyway.

No offense, but those people are entirely correct.  Choosing a
template module because of its speed when your application is
constrained by your database doesn't make sense.  None of the popular
template modules are slow at this point.


but you still save CPU if you have fast templating. maybe you can save a
number of machines. of course it's right that in most cases you shouldn't
choose the templating engine by its speed as the first critera.

when i said that many people don't care about speed because of their
database slowness i also meant that i wonder why people don't rethink
their architecture. if the database is so slow that it makes no
difference how slow your perl-code is, then there's often a possibility
to optimize that (cache things, use a search engine for searches instead
of the database, change replication architecture, ...)



Replacement for CGI.pm escape and unescape

2007-06-07 Thread cfaust-dougot
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.
 
TIA!
-Chris


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

2007-06-07 Thread Michael Peters
Jonathan Vanasco wrote:

 I use URI::Escape
 
  http://search.cpan.org/~gaas/URI-1.35/URI/Escape.pm
 
 its small, and comes in the std perl distro

Good for URI escaping, but that's not the same thing as HTML escaping, which is
what CGI's escape/unescape do right?

-- 
Michael Peters
Developer
Plus Three, LP



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

2007-06-07 Thread Perrin Harkins

On 6/7/07, Tina Müller [EMAIL PROTECTED] wrote:

but you still save CPU if you have fast templating. maybe you can save a
number of machines.


Unless your templating engine is showing up pretty high on your
Devel::DProf output, you're probably not going to save much.  Saving
5% won't mean saving a machine for anyone except really large sites
with very well-tuned machines.


when i said that many people don't care about speed because of their
database slowness i also meant that i wonder why people don't rethink
their architecture. if the database is so slow that it makes no
difference how slow your perl-code is, then there's often a possibility
to optimize that (cache things, use a search engine for searches instead
of the database, change replication architecture, ...)


I agree, and that's where people who are seeing database activity as a
bottleneck should spend their time.  They can save time on their
templating engine choice by choosing the one with the development
features that they find most useful and not trying to figure out which
one is fastest.

All I'm saying is use your optimization time wisely.  Good error
messages and an easy API are more important than speed in a templating
tool now.  If the dot notation in HTML::Template::Compiled saves a
developer a few hours of coding which can then be spent on database
query tuning, that's probably a much bigger win than any speed
difference.in templating modules.

- Perrin


Re: asynchronous perl authentication!?

2007-06-07 Thread _spitFIRE



Perrin Harkins wrote:
 
 If it's your AJAX request getting redirected, that shouldn't cause the
 page to refresh.  It may require some changes to AuthCookie to get the
 effect you want though.  Or you can go the easy way and use an IFRAME.
 
 - Perrin
 

How do I use IFRAME here? Can you give me some more info on that? Or at
least a sketch of the implementation? I'm sorry if I'm asking too much.


-- 
View this message in context: 
http://www.nabble.com/asynchronous-perl-authentication%21--tf3860218.html#a11009532
Sent from the mod_perl - General mailing list archive at Nabble.com.



Re: asynchronous perl authentication!?

2007-06-07 Thread _spitFIRE

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?


Adam Tistler wrote:
 
 Even if you use AJAX, the page will still refresh because the AuthCookie
 module's authentication method redirect's you back to the login page so
 that the session cookie can be checked.  You might be able to get around
 that by overloading the authentication method using a subrequest instead
 of a redirect, although I am not entirely sure that will work.
 

  You say something about overloading the authentication method? Does that
mean I've to overload the login method? Is that a standard way? 

  It would help me a lot if you can tell me how to send an XML back if in
case the login fails. What I mean is the following.

  sub authen_cred {

# this is the first time user is logging in
my $allow = check_user_credentials(...);

if $allow {
   # generate cookie that is checked subsequently my auth_sess_cookie
   ...
} else {
# return a XML with http status set to HTTP_FORBIDDEN
...
   }

  }

  Is that understandable? How do I implement the else part? If I simply say
something like... 

  HTTP_FORBIDDEN unless check_user_credentials(...)
  

  I see that the browser simply displays 404 on the screen. I thought that
this implies that I can break the authen_cred - auth_sess_key flow, if in
case I can return an XML and further using AJAX, can display a error message
when login fails. Let me know, if there is something that I'm overlooking
currently! Finally, what about the method 'custom_errors'; would that help?

-- 
View this message in context: 
http://www.nabble.com/asynchronous-perl-authentication%21--tf3860218.html#a11009508
Sent from the mod_perl - General mailing list archive at Nabble.com.



RE: Replacement for CGI.pm escape and unescape

2007-06-07 Thread cfaust-dougot
Yes, I'm trying to HTML escape/unescape, although looking at URI::Escape it 
seems like it might work. I'll have to give it a try.
 
Thanks!!



From: Michael Peters [mailto:[EMAIL PROTECTED]
Sent: Thu 6/7/2007 10:32 AM
To: Jonathan Vanasco
Cc: cfaust-dougot; modperl@perl.apache.org
Subject: Re: Replacement for CGI.pm escape and unescape



Jonathan Vanasco wrote:

 I use URI::Escape

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

 its small, and comes in the std perl distro

Good for URI escaping, but that's not the same thing as HTML escaping, which is
what CGI's escape/unescape do right?

--
Michael Peters
Developer
Plus Three, LP





Re: Replacement for CGI.pm escape and unescape

2007-06-07 Thread Andy Armstrong

On 7 Jun 2007, at 16:05, cfaust-dougot wrote:

Yes, I'm trying to HTML escape/unescape, although looking at  
URI::Escape it seems like it might work. I'll have to give it a try.


There's a lightweight HTML escaper in HTML::Tiny. No unescaper though.

--
Andy Armstrong, hexten.net



Re: Replacement for CGI.pm escape and unescape

2007-06-07 Thread Geoffrey Young


cfaust-dougot wrote:
 Yes, I'm trying to HTML escape/unescape, although looking at URI::Escape it 
 seems like it might work. I'll have to give it a try.

http://perl.apache.org/docs/2.0/user/porting/compat.html#C_Apache__Util__escape_html___

http://search.cpan.org/dist/HTML-Parser/

HTH

--Geoff


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 _spitFIRE


Jonathan Vanasco-3 wrote:
 
 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

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
-- 
View this message in context: 
http://www.nabble.com/asynchronous-perl-authentication%21--tf3860218.html#a11011410
Sent from the mod_perl - General mailing list archive at Nabble.com.



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

2007-06-07 Thread Perrin Harkins

On 6/7/07, _spitFIRE [EMAIL PROTECTED] wrote:

How do I use IFRAME here?


If you Google for information on how to use IFRAMEs, I'm sure you'll
find better information than I can give you.  The basic idea is that
it's a floating frame in part of your page where you put your login
form and show the result.

- Perrin


Re: [mp2] Segmentation faults with threaded worker-mpm

2007-06-07 Thread Frank Wiles
On Mon, 4 Jun 2007 14:30:01 -0400
Perrin Harkins [EMAIL PROTECTED] wrote:

  I know what you mean, but the problem here is that this mod_perl
  server *is* the reverse proxy :) There are several backend servers
  which this server will both proxy and cache the content for -
  mod_perl is, putting it simply, just needed for additional
  intelligence.
 
 If what you're saying is that you can't separate out the mod_perl bits
 with a proxy because they do things like authentication, you might be
 interested in seeing what LiveJournal does with their proxy called
 perlbal.  They use a system of internal redirects to let mod_perl
 handle auth functions and pass the file serving off to perlbal.  You
 can read about it in Brad Fitzpatrick's presentation (around silde
 45):
 http://www.danga.com/words/2007_04_linuxfest_nw/linuxfest.pdf
 
 - Perrin

   I second that recommendation.  Perlbal rocks, I use it on nearly
   every project I do these days. 

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



Re: Replacement for CGI.pm escape and unescape

2007-06-07 Thread Ronald J Kimball
On Thu, Jun 07, 2007 at 10:32:54AM -0400, Michael Peters wrote:
 Jonathan Vanasco wrote:
 
  I use URI::Escape
  
   http://search.cpan.org/~gaas/URI-1.35/URI/Escape.pm
  
  its small, and comes in the std perl distro
 
 Good for URI escaping, but that's not the same thing as HTML escaping, which 
 is
 what CGI's escape/unescape do right?

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

Ronald


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