Re: Perl extension for PHP

From: Date: Fri, 09 May 2003 10:43:38 +0000
Subject: Re: Perl extension for PHP
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-16069@lists.php.net to get a copy of this message
On Friday 09 May 2003 11:34, you wrote: > If you're interested in a hand - I'd be happy to help. Just to share > my ideas on how I would see this working (on php5 primarily). Sure :-) Do you want to share only ideas or even source? If you'd like to share source I'd apply for an PHP-CVS account to but the sources somewhere on the PECL CVS-Tree, otherwise I'd develop it on my local machine, first. (...) > but the real workhorse functionality would be through a method call > overloader so that you could say > > $retval = $p->myperlfunc($a,$b); > > where myperlfunc is a perl subroutine that you have seen in a > require/use/eval. (and of course $a, $b, and $retval are php variables > auto converted to and from perl types as needed). Yes I already implemented a perl-sub-caller for my old version and I wasn't quite sure how I should implement setting the context of a perl sub to be scalar or array, maybe we need an additional parameter for the PHP-Method, therefore I packed the paramters for the perl to a PHP-Array, so I could have extended the prototype looking like mixed perl_call(string $name, array $params, [bool $scalar = true]); so $scalar shows wether the perl sub should run on scalar or array-context - I'm running a perl application where the context is extremly important so I need a way to handle it right ;-) Another thing I was thinking of was direct acces to perl Variables like $value = $perl->foo; For scalar types this workes quite fine - I can simply access it. A problem is when I have such crazy data in perl: $foo = "bar 1"; @foo = ("bar 2"); %foo{a} = "bar 3"; What do I mean with $value = $perl->foo; ? Do I want to geht the scalar, the complete array or the complete hash? They all are called foo. In procedurel times I would have used three simple functions to make the difference, now I'm thinking about doing something like $perl->foo_scalar; $perl->foo_array; and $perl->foo_hash; So all of these access a different variable called foo. Maybe you've got a better idea ;-) > In php5 at least, these goals should not be terribly difficult to > achieve. I'm no C expert, not a Perl expert, not a real PHP expert so it's a nice task for me ;-) johannes

« previous php.pear.dev (#16069) next »