Thomas Klausner wrote:
> Is it possible and advisable to write the complex part of an application
> (the Controller, if you like) in mod_perl2 and use PHP as a frontend (or
> View) ?

Here's an excellent thread on how to do just that if you are using
mod_perl 2:

http://marc.theaimsgroup.com/?l=apache-modperl&m=111073516415824&w=2

> But: can I create a datastructure in Perl (in an ResponseHandler) and pass
> it on to PHP running also as an ResponseHandler, but afterwards. Would I
> need to stuff data in ENV? Can I pass complex data structures around? Do I
> have to serialise (to yaml/xml) between Perl and PHP?

PHP supports BerkeleyDB, SQLite, and Storable
(http://cvs.jodrell.net/index.php/php-Storable/manual.html?r=HEAD&view=true,
but I don't know offhand if you can serialize with Perl and thaw with
PHP).  Using Storable (if it works with both) and serializing the data
to environment variables is a less i/o intensive operation, but doesn't
give the added advantage of persistent data.

> Or is this a bad idea altogether and I should use a different approach (Like
> forcing everyone to read the Badger)?

If your coworkers already know PHP, this is a good idea.  Create a php
include for them to deserialize the shared data and make it available to
their templates.  And don't forget to write tests for the PHP filters :)

http://www.modperlcookbook.org/~geoff/slides/ApacheCon/2004/testing-php-with-perl.pdf


HTH,

Fred

Reply via email to