Mikael Claesson wrote:
> 
> with mod_perl it looks even better.

Cool.  Welcome.

> I plan to keep all lowerlevel database stuff in C, and
> embed it in a perl module. Will this make things run
> slower than if I made it all in perl?

Usually faster, but whether that's significant in your application
(ie will the users notice) is hard to say.  It's primarily
about productivity & maintainance vs. performance tradeoff.

XS code is a good way to preserve your existing code, I suspect.

> Will apache keep the module in memory between
> requests?

That's one of the primary advantages of mod_perl.  The other
(as I see it) is tight integration with Apache internals.

> Does this mean that I'll have to be more
> careful to free all memory that I allocate and such?

Very much so.

> No more cowboy coding?

'fraid not.

> There seems to be a module that keeps a constant mysql
> database connection open. Will this speed things up
> much? Can I use that connection in the C code (in the
> homegrown perl module)?

Yes, yes, and yes.  It might be too much of a pain to call into
perl from your C code, but you might be able to get the database
connection handle from DBI and pass it in to your C code.  Hard to
tell without knowing more about your C code and why it needs to
stay in C.  However, it should be pretty trivial to cache your
database connection yourself in your C code: just use your own
connection open routine that reuses the previous connection if
it's still valid, and never close.  That's probably easier.

Before going much further, you should probably read The Guide, as
it answers the questions you've asked (except the last) in great
detail, and more:

   http://perl.apache.org/guide/

You might also get Writing Apache Modules with Perl and C, often
referred to as "the Eagle book", by Lincoln Stein and Doug MacEachern.

HTH,

Barrie


> 
> __________________________________________________
> Do You Yahoo!?
> Send instant messages & get email alerts with Yahoo! Messenger.
> http://im.yahoo.com/

Reply via email to