PHP and Perl in One Script?
gbulmash asks: "Recently, I began working on a graphics project and wanted to use ImageMagick. As a PHP coder, I figured I'd use MagickWand for PHP. But after some investigation, I decided that an alpha at 0.1.8 with sparse documentation just wasn't going to be good enough for production use. I decided that PerlMagick would be a much better API, but I didn't want to code the whole project in Perl. In the end, I found a cool package for embedding Perl code in PHP scripts (with an article on its use) and it went to a 1.0.0 release, earlier this year. I think I've found my answer, but before I make a final decision and go ahead with it, I thought I'd ask the knowledgeable Slashdot crowd: Is there a better way of interfacing Perl with PHP so you can get the best of both worlds?"
So you've got Perl in your PHP, is there a way to do PHP in your Perl?
Why didn't you use the ImageMagick extension in PECL? There's plenty of image processing options with PHP, just because MagickWand didn't work out for you, that doesn't mean you have to concoct a monstrous hybrid of PHPerl.
Bogtha Bogtha Bogtha
There is, alas, a reason. Much wider scope for takeup of your script. Plenty of ISPs offer a well configured PHP interpreter, but most do not offer a very wide or up to date CPAN selection.
Do most hosting providers provide the software necessary to embed perl in php? If not, this is a non-conversation. Mine doesn't even give me a compiler, I have to beg if I want anything (or compile a static binary somewhere else.) To be fair, they were plenty responsive the one time I asked for anything.
"You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
For instance, accessing variables that are not defined returns nothing by default (most languages will throw an exception should this happen). This results in problems like this occuring.
There are plenty of easy to learn languages such as Python and Ruby out there that do not have nearly as many problems, so there is not too much of an excuse to use PHP for anything but the simplest web page. What this guy is trying to do, use PHP despite the fact that it is obviously not powerful enough for his requirements), is just wrong.
Mathematics is made of 50 percent formulas, 50 percent proofs, and 50 percent imagination.
Translation: You are lazy.
Come on, if your point was just that it is easier to work in PHP, you could have just compared the code needed to maintain multidimensional arrays in both languages. Instead you challenged Perl programmers to do something with only a subset of their languages features, implying (at least to young programmers visiting this thread and who do not know better) that such a feat was not possible with Perl and you need some sort of hack to get it to work. That is disingenuous at best. I want to see a valid technological reason why you would be required to develop a Perl app without using references.
Mathematics is made of 50 percent formulas, 50 percent proofs, and 50 percent imagination.
There is a php application that I've written and am still writing, and I really wish I had gone the Perl route in stead. In PHP when you hit the wall, you hit it fast and hard. The most infurating thing is when they changed default settings which broke a lot of helper libs, which were abadoned by the developers. I'm with you and now I'm converting my app to Perl and CPAN modules; no sense in developing my app, and debugging other peoples libs.
Apocalypse Cancelled, Sorry, No Ticket Refunds