barrycarlyon has asked for the wisdom of the Perl Monks concerning the following question:

Good Local Time Monks

I dont think this should be posted here but I wanted to open a sort of discusion (im not really sure where im going with this)

Given you have a perl function and a php function

You run the perl function, and then it calls a php function whilst passing it a varible

The php function reads in the varible does some processing then passes a varible back

My question is this, would the php function recieve the varible correctly and would the perl function recieve the varible correctly?

Assume the perl function is the "base" function

(by base i mean the First function (it calls the php func.)

Bazza

Barry Carlyon barry@barrycarlyon.co.uk

Replies are listed 'Best First'.
Re: Perl to PHP
by friedo (Prior) on Aug 08, 2006 at 15:07 UTC
    If you're really interested in using PHP code in your Perl programs, you can use the PHP module.

    But there is no "base" function in Perl, just the base pragma. And if you can actually cobble together working inheritence between Perl and PHP, I'd be very impressed. :)

Re: Perl to PHP (use PHP::Interpreter)
by Ovid (Cardinal) on Aug 08, 2006 at 15:44 UTC

    If you want this to really work, check out PHP::Interpreter. It might be tough to install, but it's written by a well-known PHP hacker named George Schlossnagle. It was sponsored by Portugal Telecom and released as open-source by Kineticode so they could use it with Bricolage. As a result, when you get it running, it works very well and should just "handle" stuff for you. It lets the Portugal Telecom Bricolage guys write they're templates in PHP rather than Mason or Template Toolkit yet still talk directly to Bricolage (which is written in Perl).

    Cheers,
    Ovid

    New address of my CGI Course.

Re: Perl to PHP
by ikegami (Patriarch) on Aug 08, 2006 at 15:06 UTC

    Perl can't call PHP directly, so the answer is dependant on the glue you use to allow the two to interface. You'll have to specify what you use.

    It's definitely possible to pass some values back and forth and assign those values to variables. It might not be possible to pass other values such as coderefs, regexps, globs, dualvars, blessed, etc.