Hello Arkady!
Thank you for your response!
AG> I share your approach 100%. I think, you cannot create a new CGI::App
AG> instance outside the Fast CGI loop, because you will run into "session
AG> collision" problems.
Perhaps, it would be possible if
i can create CGI::Application instance without CGI compatible object
and specify it later
--------------------------------
my $app = Pages::Admin::News->new(
PARAMS => {
dbh => $dbh,
},
QUERY => $query
);
while( my $query = new CGI::Fast ) {
$app->set_query($query);
}
--------------------------------
AG> With Fast CGI it is desirable to use a single DBI
AG> connection for all requests. Therefore, I also initialize a DB connection
AG> outside the Fast CGI loop and pass the DB handle to CGI::App instance as a
AG> parameter rather than using cgiapp_init() to initialzie a DB connection.
Exactly!
AG> Once you brought up the issue of using CGI::App with Fast CGI, I would
AG> like to ask a question too.
AG> How does HTML::Template caching work with Fast CGI + CGI::App?
I don't have enough experience in CGI::App :(
I'm using FastCGI + HTML::Template for a long time and suppose what
caching works fine in that environment.
AG> I fear that each time I create a CGI::App instance inside my Fast::CGI loop and
AG> use load_tmpl() inside my CGI::App class, the template files have to be
AG> accessed from the hard drive.
I think no. Of course if you using caching options (cache => 1).
Let's see:
1. load_tmpl:
---------
...
require HTML::Template;
...
---------
2. HTML::Template
---------
use vars qw( %CACHE );
---------
-Therefore, recurring 'require' does not clear package variable %CACHE.
-You may check the time H::T template parsed the first and second
times. (Time::HiRes)
-If you still worry, then instead of memory cache you may use shared cache
(IPC)
AG> In that case, it would make sense to
AG> initialize HTML::Template objects outside the Fast CGI loop too.
I don't see any reason.
Thanks.
Aleksey
AG> On Mon, 5 May 2003, Aleksey Serba wrote:
>> Hello Arkady,
>>
>> I'm planning to use C::A with Fast CGI.
>>
>> I incline to create new C::A instance inside Fast CGI loop
>> and pass to constructor parameters (like dbh, etc) instead of connect
>> to database in cgiapp_init in superclass.
>>
>> -----------
>> while( my $query = new CGI::Fast ) {
>> ...
>> my $app = Pages::Admin::News->new(
>> PARAMS => {
>> dbh => $dbh,
>> conf => {
>> par1 => 1,
>> par2 => 2
>> },
>> },
>> QUERY => $query
>> );
>> $app->run();
>> ...
>> -----------
>>
>> Do you create new C::A instance outside the Fast CGI loop?
>> And you don't have any problems? :)
>>
>>
>> Thanks in advance.
>>
>> Aleksey
>>
--
Best regards,
Aleksey mailto:suppressed
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.