You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Arshavir Grigorian <ag...@m-cam.com> on 2004/11/24 20:54:03 UTC

pnotes

Hello list,

I have module called Application which handles all the requests to the 
site (except for images, etc) and then dispatches the request to a 
different module based on the $r->path_info().

I am thinking about creating a Template Toolkit object and a DBI handle 
in Application::handler() and storing it in the request object's 
pnotes() before dispatching the request. The other modules that do the 
actual work, will then get those 2 "handles" from the request object 
which is passed to them anyways. Are there any problems with this approach?
Thanks.



Arshavir

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


Re: pnotes

Posted by Arshavir Grigorian <ag...@m-cam.com>.
Perrin Harkins wrote:

> Arshavir Grigorian wrote:
>
>> I have module called Application which handles all the requests to 
>> the site (except for images, etc) and then dispatches the request to 
>> a different module based on the $r->path_info().
>
>
> Apache::Dispatch could do this for you if you like.  You could also 
> just use httpd.conf to map locations to modules.  Your approach wil 
> work fine though.
>
>> I am thinking about creating a Template Toolkit object and a DBI 
>> handle in Application::handler() and storing it in the request 
>> object's pnotes() before dispatching the request.
>
>
> Make sure you keep the template object around between requests in a 
> global.  If you make a new TT object every time, you will break the 
> caching of compiled templates and performance will be poor.
>
> - Perrin

Thanks, Perrin. --Arshavir



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


Re: pnotes

Posted by Perrin Harkins <pe...@elem.com>.
Arshavir Grigorian wrote:
> I have module called Application which handles all the requests to the 
> site (except for images, etc) and then dispatches the request to a 
> different module based on the $r->path_info().

Apache::Dispatch could do this for you if you like.  You could also just 
use httpd.conf to map locations to modules.  Your approach wil work fine 
though.

> I am thinking about creating a Template Toolkit object and a DBI handle 
> in Application::handler() and storing it in the request object's 
> pnotes() before dispatching the request.

Make sure you keep the template object around between requests in a 
global.  If you make a new TT object every time, you will break the 
caching of compiled templates and performance will be poor.

- Perrin

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


Re: pnotes

Posted by Bart Simpson <ba...@yahoo.com>.
> > Arshavir Grigorian wrote:
> >
> >> Hello list,
> >>
> >> I have module called Application which handles
> all the requests to 
> >> the site (except for images, etc) and then
> dispatches the request to 
> >> a different module based on the $r->path_info().
> >>
> >> I am thinking about creating a Template Toolkit
> object and a DBI 
> >> handle in Application::handler() and storing it
> in the request 



Sounds like your may be doing what i started out doing
-- parse the path into a function call on a model
object to get some data then pass it to a template. 
If this is on the mark, check out Maypole. I does all
this for you. I love it and it saved me so much work
and is soooo much better than any system i could have
came up with myself, me being a newbie and all.  Plus
it is a great deal more fun. I literally can't imagine
my work life without it now.  

 mapole.perl.org or on CPAN.

p.s. The base for the lone modperl handler in a
maypole app is , called Application too. Specifically,
Maypole::Application. :)


		
__________________________________ 
Do you Yahoo!? 
Read only the mail you want - Yahoo! Mail SpamGuard. 
http://promotions.yahoo.com/new_mail 

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


Re: pnotes

Posted by Arshavir Grigorian <ag...@m-cam.com>.
Stas Bekman wrote:

> Arshavir Grigorian wrote:
>
>> Hello list,
>>
>> I have module called Application which handles all the requests to 
>> the site (except for images, etc) and then dispatches the request to 
>> a different module based on the $r->path_info().
>>
>> I am thinking about creating a Template Toolkit object and a DBI 
>> handle in Application::handler() and storing it in the request 
>> object's pnotes() before dispatching the request. The other modules 
>> that do the actual work, will then get those 2 "handles" from the 
>> request object which is passed to them anyways. Are there any 
>> problems with this approach?
>
>
> That should work.
>
> (in this particular case it should be the same for any modperl 
> generation, but in the future don't forget to explicitly specify which 
> mp version you are using. thanks)
>
Thanks, Stas. I will try to be more specific next time.


Arshavir

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


Re: pnotes

Posted by Stas Bekman <st...@stason.org>.
Arshavir Grigorian wrote:
> Hello list,
> 
> I have module called Application which handles all the requests to the 
> site (except for images, etc) and then dispatches the request to a 
> different module based on the $r->path_info().
> 
> I am thinking about creating a Template Toolkit object and a DBI handle 
> in Application::handler() and storing it in the request object's 
> pnotes() before dispatching the request. The other modules that do the 
> actual work, will then get those 2 "handles" from the request object 
> which is passed to them anyways. Are there any problems with this approach?

That should work.

(in this particular case it should be the same for any modperl generation, 
but in the future don't forget to explicitly specify which mp version you 
are using. thanks)

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

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