Slashdot Mirror


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?

174 comments

  1. Simple by NutscrapeSucks · · Score: 1

    Just use the Windows Scripting Host!

    --
    Whenever I hear the word 'Innovation', I reach for my pistol.
  2. A bit extreme by Bogtha · · Score: 5, Insightful

    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
    1. Re:A bit extreme by kv9 · · Score: 2, Interesting
      wow, it's when i see questions like these that i realize what kinda people code PHP and give it such a bad name. first of all, you could have just used the PECL extension as suggested above, which *will suffice*. or, in the worst case just exec() the binaries, like any normal person would do. not bringing Perl into the equation. what in the name of doctor frankenstein?

      </outraged>

    2. Re:A bit extreme by billcopc · · Score: 3, Funny

      <? bighair() { ?>
      Shot through the code,
      and you're too lame.
      You give PHP
      a bad name.
      <? } ?>

      --
      -Billco, Fnarg.com
  3. Re:If you use PHP.... by norkakn · · Score: 0, Offtopic

    I love the smell of napalm in the morning. It smells like... victory.

  4. We've known this for a while by agent+dero · · Score: 1

    I thought this was already publicized, Perl & PHP in one script? Isn't that just a brain fuck :)

    --
    Error 407 - No creative sig found
  5. If you want to use Perl, use Perl! by Anonymous Coward · · Score: 5, Informative

    Instead of going with some bizarre rube-goldberg hack like this (does it even work with dynamically loadable Perl modules?), just write a separate Perl script that does what you need and receives data on standard input and gives responses on standard output. Use PHP's proc_open() function. You can even set up the Perl script as a daemon, if you like, and get higher performance.

    I used this same trick to interface a binary-only executable to my PHP script. You can even use XML to pass the data back and forth, if you swing that way. I don't know how this might work on Windows, if that's what you're running on.

    By the way, version numbers mean absolutely nothing except the author's opinion of his own software. In fact, the article you posted says: "the extension is still marked EXPERIMENTAL". Sounds like alpha to me.

    Not to mention, this is the same guy that wrote Turck MMCache and in my testing, mmcache couldn't stay stable for more than a day or two, and would randomly return junk characters instead of output from our PHP scripts. Not exactly an author I'd trust for this kind of lower-level stuff. (Yeah, I know, there are 10 billion geeks who used MMCache on their 5-hit-per-day blog and it worked perfectly, and will not hesitate to point this out. It just didn't work for me, and other products did, sorry!)

    For what it's worth, I've used "pecl-imagick-0.9.11" on my Gentoo servers to manipulate images (basically, to generate thumbnails by resizing and sharpening) and it works perfectly. I think this is different than what you're talking about. So unless you really just can't live without Perl (?), try that first.

    Instead of looking at version numbers, test thoroughly.

    1. Re:If you want to use Perl, use Perl! by 1iar_parad0x · · Score: 1

      You could write a web service or use XML-RPC and call it remotely as well. However, the call to the "command line" works too. Frankly, it might make sense to move the heavy image processing to a remote process anyway. You certainly wouldn't want a HTTP timeout error on your response because you server is overworked.

      --
      What do you mean my sig is repetitive? What do you mean my sig is repetitive? What do you mean....
  6. Re:If you use PHP.... by Anonymous Coward · · Score: 2, Funny

    I can't see any possibility of flamewars in this subject.

  7. Re:If you use PHP.... by linvir · · Score: 1
    As a PHP coder,
    Does this mean nothing to you?
  8. Re:If you use PHP.... by Anonymous Coward · · Score: 2, Insightful

    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.

  9. Apache notes? by Anonymous Coward · · Score: 0

    http://uk.php.net/manual/en/function.apache-note.p hp

    Hopefully you'll come to your senses first.

  10. It's like peanut butter and chocolate... by heinousjay · · Score: 5, Funny

    All the security of PHP and all the readability of Perl? It's a surefire win. I wonder why the whole world hasn't caught on to this one yet?

    --
    Slashdot - where whining about luck is the new way to make the world you want.
    1. Re:It's like peanut butter and chocolate... by Anonymous Coward · · Score: 4, Funny

      Dude #1: You got your Perl in my PHP!
      Dude #2: You got your PHP in my Perl!

      Announcer: Two great languages that only taste a little bit funny together. Now with less whitespace!!!

      Oh yeah, kids. Don't forget to try our other product, "Mac & PC". It's the cheesiest!

    2. Re:It's like peanut butter and chocolate... by Rysc · · Score: 1

      You owe me a new keyboard.

      --
      I want my Cowboyneal
    3. Re:It's like peanut butter and chocolate... by quokkapox · · Score: 0, Flamebait

      All the security of PHP and all the readability of Perl? It's a surefire win. I wonder why the whole world hasn't caught on to this one yet?

      Ummm, maybe the legendary robustness and scalability of IIS and ASP?

      --
      it's a blue bright blue Saturday hey hey
  11. Re:If you use PHP.... by nwbvt · · Score: 1
    "If you use PHP....God kills a kitten"

    What if you don't like cats?

    Hey, I might have found the first legit reason for using PHP!

    --
    Mathematics is made of 50 percent formulas, 50 percent proofs, and 50 percent imagination.
  12. Re:If you use PHP.... by drinkypoo · · Score: 3, Insightful

    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.'"
  13. Re:If you use PHP.... by 0racle · · Score: 0, Flamebait

    It means you chose to use an inferior language.

    --
    "I use a Mac because I'm just better than you are."
  14. Hey lover-boy by Anonymous Coward · · Score: 0, Funny

    > To be fair, they were plenty responsive the one time I asked for anything.

    That's enough about butt-sex, plz stay on topic in future.

  15. Hello there, Comrade Molotov! by mangu · · Score: 2, Funny

    Ahhh, nothing like a good flamewar! OK, I'll bite. Tell me, please, how do you write multidimensional arrays in Perl? No, no, you are *not* allowed to use references! Or what about a multidimensional hash? Suppose I wanted to migrate from PHP to Perl, how would I translate this perfectly valid PHP code to Perl:

    $x["a"]["b"]["c"] = "d";

    I mean, can you do it the Perl way, with less keystrokes?

    1. Re:Hello there, Comrade Molotov! by WilliamSChips · · Score: 1

      Nope, but you can do it in Python, which is a superior language to both Perl and PHP.

      --
      Please, for the good of Humanity, vote Obama.
    2. Re:Hello there, Comrade Molotov! by powerlord · · Score: 1

      okay ... I'll take the bate.

      The perl equivalent of $x["a"]["b"]["c"] = "d";
      would be $x["a"]["b"]["c"] = "d";

      Gee ... I didn't know PHP could be such an elegant language also. :)

      What? I'm not allowed to use references?

      What about the ones that are implied? Like those cute little '[]' your statement used.

      Similar to the implied reference that makes ANY array code work, by taking the starting address and jumping X units into the array to access a member.

      --
      This space for rent. All reasonable inquiries will be entertained at proprietors discretion.
    3. Re:Hello there, Comrade Molotov! by iwrigley · · Score: 5, Informative

      Erm... how about

      $x{'a'}{'b'}{'c'} = 'd';

      Yes, it uses references, but if you're scared of them, pretend it's a 'real' multidimensional hash.

    4. Re:Hello there, Comrade Molotov! by bunratty · · Score: 1

      PHP:
      $x["a"]["b"]["c"] = "d";

      Perl:
      $x[a][b][c] = "d";

      You can put also write it the PHP way (with all the quotes) in Perl, if you really want to.

      --
      What a fool believes, he sees, no wise man has the power to reason away.
    5. Re:Hello there, Comrade Molotov! by Ayanami+Rei · · Score: 1
      You mean like this?
      %hash = ( a => { b => { c => d }} );
      if($hash{"a"}{"b"}{"c"} == "d") {
        print "Whoops... guess you never ran \"man perllol\"\n";
      }
      ### Similarly, for arrays (which are different and faster than hashes in Perl, unlike PHP)
      $array[0][1][2] = 3;

      The old syntax you might be thinking of was:
      $hash{"a"}->{"b"}->{"c"} = "d";

      Perl has auto-reference traversal for adjacent {}/[] for some time now.
      You still might need a single arrow:
      $myref->{"bar"}{"baz"}
      if myref is a reference and not a strict hash or array like the first two examples.
      (You often get "real references" thrown from functions that don't want to shallow copy
        hashes for no good reason onto the stack, and OO Perl uses them heavily)

      --
      THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
    6. Re:Hello there, Comrade Molotov! by novas007 · · Score: 2, Informative

      $y[0][0][0] = 0;
      $x{a}{b}{c} = 'd';

      Beat you by 6 characters on that second one. And if I'm not allowed to use references, you're not allowed to use strings. Perl is designed with references in mind.

      --
      To smash a single atom, all mankind was intent / Now any day the atom may return the compliment
    7. Re:Hello there, Comrade Molotov! by VGPowerlord · · Score: 1
      #!/usr/local/bin/perl

      use strict;
      my @x;
      $x[a][b][c] = "d";
      Bareword "a" not allowed while "strict subs" in use at orange.pl line 5.
      Bareword "b" not allowed while "strict subs" in use at orange.pl line 5.
      Bareword "c" not allowed while "strict subs" in use at orange.pl line 5.
      Execution of orange.pl aborted due to compilation errors.
      --
      GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
    8. Re:Hello there, Comrade Molotov! by VGPowerlord · · Score: 1

      Except that the second one chokes if use strict; is in effect.

      --
      GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
    9. Re:Hello there, Comrade Molotov! by nwbvt · · Score: 1

      "Tell me, please, how do you write multidimensional arrays in Perl? No, no, you are *not* allowed to use references!"

      Is there a reason for this restriction? I mean, if you take out a major part of a language, you are going to be limited in what you can do with it. That doesn't mean the language is no good or another language is better, it just means you have to learn how to use that feature.

      --
      Mathematics is made of 50 percent formulas, 50 percent proofs, and 50 percent imagination.
    10. Re:Hello there, Comrade Molotov! by Anonymous Coward · · Score: 0

      Except that the second one chokes if use strict; is in effect.

      No it doesn't.

    11. Re:Hello there, Comrade Molotov! by Anonymous Coward · · Score: 0

      Dude. On behalf of Perlmongers everywhere: stay off our side until you can give answers that actually compile.

    12. Re:Hello there, Comrade Molotov! by novas007 · · Score: 1

      *Shrug* they both do, actually. It's because you have to declare hashes or arrays to make that work properly under strict. I didn't think it was fair to have strict on when comparing it to php, because php has no strict.

      --
      To smash a single atom, all mankind was intent / Now any day the atom may return the compliment
    13. Re:Hello there, Comrade Molotov! by VGPowerlord · · Score: 1
      $x[a][b][c] = "d";

      is perfectly valid in PHP, but it throws a notice (similar to perl's warnings) that shows up in log files, or as output if error_reporting(E_ALL) is set.

      I always program with use strict in effect, and most of the time, -w or use warnings as well. Similarly, I like setting error_reporting(E_ALL) if I'm using PHP.

      --
      GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
    14. Re:Hello there, Comrade Molotov! by mangu · · Score: 1
      you are *not* allowed to use references!

      Is there a reason for this restriction?


      Yes, the main reason for the existence of interpreted languages: simplicity. If I have to start worrying about references, then I'd rather do it in C and worry about pointers instead. For the same development effort I gain a couple of orders of magnitude in execution speed.


      PHP has this advantage over Perl, arrays, dictionaries, hashes, they all behave more or less the same way, you need not worry too much about them. In Perl you have to be careful about that distinction. Also, there is no multidimensional array of values, only references. Handling multidimensional arrays is much easier in PHP.

    15. Re:Hello there, Comrade Molotov! by mobby_6kl · · Score: 1

      perl -e "$x['a']['b']['c'] = 'foo'; print $x['a']['b']['c'];"
      foo

    16. Re:Hello there, Comrade Molotov! by nwbvt · · Score: 2, Insightful
      " Yes, the main reason for the existence of interpreted languages: simplicity."

      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.
    17. Re:Hello there, Comrade Molotov! by holy+zarquon's+singi · · Score: 1

      Ok if you want all that automagic stuff that you get with php operators use the Template Toolkit. Everything.is.accessed.by.a.magic.dot.operator. The slash engine uses it, but slash is a bit legacy, and should use Catalyst+TT or Jifty instead these days . That's withough phps 'orrible namespace pollution problems too :)) No probs, glad to help.

      --
      "...we should just trust our president in every decision that he makes and we should just support that." B.Spears 2003
    18. Re:Hello there, Comrade Molotov! by jrockway · · Score: 1

      WTF perl are you using? You can't use strings as array elements.

      [~] 0 (jon@foo)
      $ perl -e "$x['a']['b']['c'] = 'foo'; print $x['a']['b']['c'];"
      syntax error at -e line 1, near "]["
      syntax error at -e line 1, near "]["
      Execution of -e aborted due to compilation errors.

      The correct way to do this is:

      [~] 0 (jon@foo)
      $ perl -e '$x->{a}->{b}->{c} = qq{foo\n}; print $x->{a}->{b}->{c};'
      foo

      If you were only dealing with numbers, then this would work:

      $ perl -e '$x[1][2][3] = qq{foo\n}; print $x[1][2][3];'
      foo

      Either way, you're still "using references". I don't know why you would want to avoid them, though, they're an excellent feature and they're very easy to use.

      --
      My other car is first.
    19. Re:Hello there, Comrade Molotov! by jrockway · · Score: 1

      > I want to see a valid technological reason why you would be required to develop a Perl app without using references.

      How about, "I'm too stupid to read the manual." :)

      --
      My other car is first.
    20. Re:Hello there, Comrade Molotov! by rduke15 · · Score: 1

      WTF perl are you using?

      He used Perl on Windows, where you need double quotes around the argument, and OS variables do not start with $.

      On linux, it would be:

      $ perl -e '$x[a][b][c] = "foo"; print $x[a][b][c];'
      foo


      (basically the same as in PHP, except that you can omit a few quotes in this case.)

    21. Re:Hello there, Comrade Molotov! by jrockway · · Score: 1

      The only reason that works is because the barewords a,b, and c evaluate to zero. If you wanted a , b, and c to be strings, that wouldn't work.

      Please learn perl before posting.

      [~] 0 (jon@foo)
      $ perl -Mstrict -e '$x[a][b][c] = "foo"; print $x[a][b][c];'
      Global symbol "@x" requires explicit package name at -e line 1.
      Global symbol "@x" requires explicit package name at -e line 1.
      Bareword "a" not allowed while "strict subs" in use at -e line 1.
      Bareword "b" not allowed while "strict subs" in use at -e line 1.
      Bareword "c" not allowed while "strict subs" in use at -e line 1.
      Bareword "a" not allowed while "strict subs" in use at -e line 1.
      Bareword "b" not allowed while "strict subs" in use at -e line 1.
      Bareword "c" not allowed while "strict subs" in use at -e line 1.
      Execution of -e aborted due to compilation errors.

      --
      My other car is first.
    22. Re:Hello there, Comrade Molotov! by Achromatic1978 · · Score: 1
      I didn't think it was fair to have strict on when comparing it to php, because php has no strict.

      Even when this argument is as the result of people arguing Perl 'enforces' 'better' programming practices than PHP? That'd be a compelling argument to say that you shouldn't not 'use strict'.

    23. Re:Hello there, Comrade Molotov! by rduke15 · · Score: 1
      The only reason that works is because the barewords a,b, and c evaluate to zero

      Oops. You are right of course, and the [] need to be replaced by {}.

      And yes, if you use strict, you have to quote the strings, but that is optional (and PHP doesn't have "use strict" anyway).

      The point is: you can do the same in Perl, and it's not more difficult.
      $ perl -MData::Dumper -e '$x{a}{b}{c}="foo"; $x{d}{e}{f}="bar"; print Dumper(\%x);'
      (/. doesn't let me post the output)
    24. Re:Hello there, Comrade Molotov! by Eivind+Eklund · · Score: 1
      'cause I'm doing retrocomputing and only have Perl 4 available...

      Apart from that, I still recommend Perl 7 (Ruby) instead of Perl 5.

      Eivind.

      --
      Doubting the existence of evolution is like doubting the existence of China: It just shows that you're uninformed.
    25. Re:Hello there, Comrade Molotov! by Anonymous Coward · · Score: 0

      Nope

      Wrong.

      but you can do it in Python, which is a superior language to both Perl and PHP

      If you weren't aware that you could do that simple task in Perl, you aren't qualified to come to that conclusion.

  16. CPAN! by schweini · · Score: 3, Informative

    as almost always, CPAN is your friend in all things perl-related.

    aside from that, i really don't understand why you'd use PHP if you're familiar enough with perl to use it.

    1. Re:CPAN! by VGPowerlord · · Score: 1
      1. Perl using standard CGI is slower than PHP's mod_php
      2. Perl using mod_perl is more complicated than PHP's mod_php

      mod_perl really is a big issue. In PHP, something that runs under two identical setups, one that uses mod_php and the other that uses PHP CGI will run identically.

      mod_perl's caching and function wrapping can lead to unexpected results with global variables and modules (See: perldoc FindBin).

      --
      GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
    2. Re:CPAN! by stevey · · Score: 1

      two identical setups, one that uses mod_php and the other that uses PHP CGI will run identically.

      If they are identical setups, sure.

      I've run into minor/annoying problems when upgrading PHP on hosts though. The defaults of the language will change (eg. RegisterGlobals), and the available extensions can get broken in upgrades.

      There are a lot of times when taking a working PHP script from one host to another will result in errors and require a fiddle to get sorted. By contrast perl is simpler to use since the defaults rarely change, and installing dependency modules is usually simple.

      Personally most of my code is written in Perl with Danga's Memcached used to cache database results.

    3. Re:CPAN! by VGPowerlord · · Score: 1

      I wrote a journal entry about things that pissed me off in PHP before. The programming environment changing because of INI file settings was high on the list. The language changing was up there, too, particularly with 5.0 no longer having the old-style global arrays by default ($HTTP_POST_VARS and the like, rather than $_POST).

      --
      GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
    4. Re:CPAN! by Achromatic1978 · · Score: 1
      available extensions can get broken in upgrades

      My solution to this has always been to do a phpinfo(); before upgrading. The top section will contain the ./configure line used for that build - then I just use that for the upgrade.

  17. Re:If you use PHP.... by powerlord · · Score: 3, Informative

    As Iunderstand it ... Mason, a perl based web authoring kit has been used by quite a few web sites, including Amazon.

    Yeah ... I guess their website is just painfully slow and prone to problems.

    --
    This space for rent. All reasonable inquiries will be entertained at proprietors discretion.
  18. Re:If you use PHP.... by Anonymous Coward · · Score: 0

    I can't see any possibility of flamewars in this subject.

    Just wait until the Ruby-folks have finished their daily 4 hour circlejerk-gathering and read this.

    "omg ruby has closures monads omg agile wepp too ow omg" seems to be their favourite argument in favour of their toy language.

  19. Ruby on Rails by Anonymous Coward · · Score: 5, Funny

    I'm probably going to get flamed for this but have you considered using rails? Seriously, you just spend a couple of hours installing it on your development box before you discover the speed and power of rails. Then when you've used the programming equivilent of a lumphammer to sculpt your fine detailed script, you get to spend the next week looking for hosting. I do all my development on a gentoo box, it only took me a weekend to set up from stage 1. I have some great USE flags that make my RAILS development go super fast and gentoo only takes about 1.5 hours a week to maintain. Well, sometimes it takes a little longer because the QA is non-existent of late.

    That's what I'd do anyway, RoR running on gentoo with some kicking USE flags. I'm developing a complete Ajax OS in my spare time using this system. It's going to revolutionize the OS market and yes, it will have use flags.

    1. Re:Ruby on Rails by horatio · · Score: 1

      you get to spend the next week looking for hosting

      dreamhost, which has RoR hosting :)

      --
      There is very little future in being right when your boss is wrong.
    2. Re:Ruby on Rails by Yonzie · · Score: 1

      Now, you wouldn't happen to be an affiliate with Dreamhost, would you?

      Dreamhost gets an F from the BBB which is the worst possible score a business can get...
      (BBB Rating scale)

    3. Re:Ruby on Rails by fullphaser · · Score: 1

      Nope, just like most of us here he found a host and he can help but gloat about how much better a deal it is then say X host, Its a status thing you know. Why market when the nerds who buy your hosting will do it for you? oh, and PHP and Perl right? Hmm... yes Well I bet ASP could do it

      --
      Did someone say cake?
    4. Re:Ruby on Rails by horatio · · Score: 1
      you wouldn't happen to be an affiliate
      Negative. I'm a happy customer. I looked at your BBB report, and there is no apparent reason for the rating:

      • We know of no licensing or registration requirement for companies engaged in this company's stated type of business.
      • We have no further comment about this company's business practices or analysis of its offer that may assist you in your consideration of this company.
      • Our complaint history for this company shows the company gave proper consideration to some complaints presented by the Bureau.

        Although in some cases the company failed to respond to complaints.
      • We know of no government action taken against this company.
      • No question about the truth of this company's advertising has come to our attention.
      • We know of no other matter or practice relating to this company that may assist you in your consideration of this company.


      The sole negative in the entire report is the failure to respond to some complaints ... I would get an F as well for failing to properly respond a few weeks ago to an unruly and unreasonable customer who decided to attack me personally in her email ...
      --
      There is very little future in being right when your boss is wrong.
    5. Re:Ruby on Rails by vacorama · · Score: 1

      i'll attest, while on the verge of invevsting in a dedicated server, i tried dreamhost a few months ago. after the first week, i moved all my websites there and life has been much easier since. they rule!

    6. Re:Ruby on Rails by slaker · · Score: 1

      Dreamhost has been wonderful for me and for all of the people I've turned onto it. I've used some really crappy hosting in the past, my personal favorite being a hosting company that wouldn't allow FTP access to anything.

      Dreamhost has been reliable and seems to be pre-configured for everything I've ever wanted to do or try.

      The couple of times I've had support issues, I've gotten responses in around a half hour.
      No complaints. I'm happy to give them my money and to suggest others do likewise.

      --
      -- I wanna decide who lives and who dies - Crow T. Robot, MST3K
  20. Well, duh! by Xaroth · · Score: 1

    So you've got Perl in your PHP, is there a way to do PHP in your Perl?

    Sure!

    </joke>

  21. Bring on the VM's by Anonymous Coward · · Score: 0

    You'd never guess it from the moronic comments here but mixing dynamic languages will be common one day, until then:

    http://parrotcode.org/
    http://nekovm.org/

  22. Re:If you use PHP.... by Soong · · Score: 3, Informative

    Huh, some perl driven web apps:
    http://www.slashcode.com/
    http://scoop.kuro5hin.org/

    I have been trolled. Hope this helps. Have a nice day.

    Personally I prefer Java Servlets, with perl a second place, then python, then bash, then C, then php.

    --
    Start Running Better Polls
  23. Re:If you use PHP.... by Anonymous Coward · · Score: 0

    Throwing a couple thousand servers behind a web app solves just about any performance issue.

  24. Just use php's functions? by Xzzy · · Score: 3, Interesting

    I know ImageMagik is the kitchen sink of image editing, but have you looked into PHP's embedded image functions? There's very few effects you couldn't produce on your own with those functions. I'll grant it's probably easier to just pass arguments to the ImageMagik library, but probably not more efficient.

    Allows you to avoid the problems of calling ImageMagik, piping it through perl, then doing whatever you need to do in PHP. Sounds like a recipie for excessive server load, to me.

    1. Re:Just use php's functions? by Fordiman · · Score: 1

      Seriously, you're better off using temp files and the CLI for ImageMagick.

      --
      110100 1101000 1101000 1100110 0 1101111 1101000 1100011 1
    2. Re:Just use php's functions? by SimHacker · · Score: 1

      You'd probably be a LOT better off it you used Python and the Python Imaging Library, instead of trying to noodle around with combining PHP/Perl/ImageMagick.

      First of all, PIL can solve your imaging problem, but more importantly, Python can solve your PHP problem. And then you won't have to get yourself hooked on a Perl problem as well.

      There is of course an ImageMagick module for Python. But I prefer to use PIL, which is full featured, well integrated with Python, robust and efficient, and plays nicely will with Numerical Python.

      -Don

      --
      Take a look and feel free: http://www.PieMenu.com
    3. Re:Just use php's functions? by Fordiman · · Score: 1

      Almost any solution is better than mixing languages, but generally, it's best to use what's already configured (apparently PHP in this case), if time is a constraint.

      And yes, we know you have a favorite language. Most developers have one for interpreted and one for compiled (except those weird java guys who think they have the best of both worlds). I'm partial to C++ and perl myself. I could sit here and tout all the things that make me like it, but lets face it, most of the stuff I like about Perl, a Ruby user (to pull a random non-perl human from the air) would find intolerably designed.

      Yeah. Point is, unless someone asks, "Well, what SHOULD I use?", leave it at criticisms or appraisals of the technique asked about.

      --
      110100 1101000 1101000 1100110 0 1101111 1101000 1100011 1
    4. Re:Just use php's functions? by SimHacker · · Score: 1

      As you said, the things that Perl programmers love about the language make other programmers hate it. But that's peculuar to Perl, which is one of the only languages that goes out of its way to be hard to program, hard to read, hard to learn, and hard to understand, on purpose.

      PHP is simply ignorant, not designed badly on purpose. When people who understand programming language design point out PHP's faults to its designers (who obviously don't understand programming language design, because if they did, they wouldn't have made all those mistakes in the first place), at least they attempt to correct the problems in the next version of PHP, to the dismay of all the programmers whose PHP programs depended on that badly designed behavior. That's why each version of PHP breaks programs written for the previous version.

      But on the other hand, Perl is absolutely maliscious, and designed badly on purpose. When people who understand programming language design point out Perl's faults to its designers (who should have known better), they get defensive, go out of their way to rationalize their problems, strike back by putting even more badly designed features and pointlessly complex syntax into the language, slapping on band-aids, paper machette, and self-adhesive Michael-Jackson-Noses to cover up the problems, and then they pretend like all those hacks and kludges are actually good ideas, which make Perl more enjoyable to their tastes.

      Python and Ruby are designed the opposite way as Perl, by people who actually understand programming language design. They have low syntactic surface area and simple semantics on purpose, so they're easy to learn, easy to read, easy to understand, easy to use, easy to maintain, and even nice to look at!

      Programming in PHP is like building a house out of straw. But programming in Perl is like building with Lead and Asbestos. There's no excuse for not knowing about the dangers, and anyone who denies that Perl has many fundamental problems is a liar. It's simply irresponsible, and whoever does it professionally deserves to have their ass sued off for being so incompetent to expose their employer and users to such hazards.

      When somebody announces they're using an ignorant language like PHP, and wants to mix it with a dangerous language like Perl, the right thing to do is to warn them that both langauges they're using are bad, for different reasons, and offer some better alternatives. Turing completeness does not mean that all programming languages are the same. Programming language design is user interface design, because programmers are language users. And there is no excuse for using a bad user interface, when so many better ones are available. Like drunk drivers talking on cell phones, Perl advocates need to be pulled over, taken off the road, and reformed, to stop them from causing more horrible accidents, and recruiting others to repeat their dangerous behavior.

      -Don

      --
      Take a look and feel free: http://www.PieMenu.com
    5. Re:Just use php's functions? by Fordiman · · Score: 1

      *sigh*

      Ok, my point was (and it's taking some work to remember it - who argues a point two weeks later?):
      Most casual web developers don't have control over what interpreters their server supports; they're rather at the mercy of the ownes they're renting time and bandwidth from. As such, they have to make do with what's there. What's there is that which is ubiquitous, and unfortunately, that's PHP and Perl, anymore. Unless they want to work in ASP.

      --
      110100 1101000 1101000 1100110 0 1101111 1101000 1100011 1
    6. Re:Just use php's functions? by SimHacker · · Score: 1

      So why stick with an inferior web hosting company? Python is already installed on most modern Linux systems, and it's free and easy to install on all Linux, Windows and Mac systems. If a web hosting company doesn't offer it, then they're hopelessly behind the time. If they refuse to install it, then their service sucks and they have no respect for their customers. If Python is missing and your provider refuses to install it, then it's only a symptom of much worse problems. What are you going to do when they refuse to install Perl or PHP modules you depend on, or upgrade Perl and PHP and fix security holes as soon as they're reported?

      Why make the wrong decision about programming languages, just because you made the wrong decision about hosting providers? If your provider doesn't support Python, or install it when you ask, then you should dump them, because they don't deserve to stay in business. There is no shortage of quality web hosting providers who support Python and other scripting languages that are better than Perl and PHP.

      Would you send your kids to an elementary school that taught Intelligent Design, but didn't support Evolution? Are you resigned to raising your children to be superstitious idiots because their parochial school refuses to change their ignorant ways, or would you switch them to another better school?

      -Don

      --
      Take a look and feel free: http://www.PieMenu.com
    7. Re:Just use php's functions? by Fordiman · · Score: 1

      Let me put it in this perspective:

      I work at a University. I am given the task of setting up and maintaining my depeartment's webpage. I would love to be using ruby, personally, however, I'm stuck dealing with my school's hopelessly microsoft-addicted IT department. As such, I'm rather forced into using ASP (the VBScript variant, no less). I've argued the point of how much more superior Ruby is, how much cleaner the code would be. I've gone over the security flaws inherent in using ASP and IIS, etc. It falls on deaf ears. Even just asking for a new object to use is impossible.

      So I'm stuck with what I got, and I make the best of it. If I was to ask for advice on, say, how to make a mailer for ASP, and someone told me to use something else instead, it wouldn't be helpful, as I need to know the ASP hooks for doing it, not the contents of a language superiority discussion.

      Mind you, I've been on the recieving end of MANY of these discussions, mostly when I'm already locked in to something.

      --
      110100 1101000 1101000 1100110 0 1101111 1101000 1100011 1
  25. Ooo, nice! by Poromenos1 · · Score: 1

    I'm writing a processor in RoR, wanna cooperate? :P

    --
    Send email from the afterlife! Write your e-will at Dead Man's Switch.
  26. Re:If you use PHP.... by Unnamed+Chickenheart · · Score: 3, Funny

    I am in no way an expert of programming nor web... ...but from my surfing experience, it seems like html + PHP creates very fast websides.

    (And PHP can do funky things like change colours on events like mouseover etc? groovy! )

    --
    urd
  27. ImageMagick? by martinultima · · Score: 3, Informative

    I tend to use ImageMagick a lot via PHP scripts, but not with any sort of polyglot of code or anything – I just use exec("convert ... ");. It's probably not the most cross-platform way, but since I tend to do exclusively Linux/UNIX-based stuff, and most of the code is only used by me for my own sites anyway, it's not a problem at least as far as I'm concerned.

    --
    Creative misinterpretation is your friend.
    1. Re:ImageMagick? by RomulusNR · · Score: 1

      MediaWiki, as an example, does essentially the same thing.

      includes/DefaultSettings.php:
      $wgImageMagickConvertCommand = '/usr/bin/convert';

      includes/Image.php:
      $cmd = $wgImageMagickConvertCommand .
                        " -quality 85 -background white -geometry {$width} ".
                        escapeshellarg($this->imagePath) . " " .
                        escapeshellarg($thumbPath);
                        $conv = shell_exec( $cmd );


      Otherwise, when ImageMagick is not installed/configured, it too reverts to PHP's GD calls, using imagecopyresampled().

      --
      Terrorists can attack freedom, but only Congress can destroy it.
  28. Re:If you use PHP.... by batkiwi · · Score: 1

    I would be worried by a hosting provider that included a compiler on a production system. There is no need for one, and most *nix worms require the existance of one.

    It's a basic security best practice.

  29. Re:If you use PHP.... by martinultima · · Score: 4, Interesting

    Bit off-topic, but if you need those kinds of features (compilers, custom Perl modules, etc.) maybe check out one of the user-mode Linux Web hosts like Linode.com – they've been running my site for a few months, and I'd say it's probably the best thing since Al Gore invented the Interwebs :-) You get your own distribution, your own choice of server configurations... it's like a dedicated server without the dedicated server. [Not trying to sound like an advertisement or anything like that, just a very happy user recommending a useful service.]

    --
    Creative misinterpretation is your friend.
  30. Re:If you use PHP.... by Anonymous Coward · · Score: 2, Funny

    Come now, you sound like every other expert PHP programmer to me.

  31. Incidentally... by Ayanami+Rei · · Score: 1

    The fact that you had to do this:
    $x->{"outer hash of references to hashes"}->{"inner hash of scalars or refs"}
    Was Perl just being precise
    The outer '$' sigil indicates you wish to treat the whole expression as a scalar lvalue or rvalue.
    The first '->' indicates you wish to deference a scalar named 'x'.
    The first '{...}' indicates you wish to treat (deferenced x) as a hash and use the lookup operator on it.
    The second '->' indicates you wish to treat the return value of the lookup as a reference, and dereference that.
    The inner '{...}' is the final hash lookup, which returns the scalar you wanted originally.

    Incidentally, whenever you see this notation:
    @array[$index]
    Internally perl is really doing:
    *array->[$index]
    Because array is just an entry in a symbol table that is a reference (just like how arrays in C are pointers, or in Java are objects references).
    But the @ notation carries additional connatations: when you use it as an lvalue it performs a shallow copy of the array in the rvalue (unlike a scalar reference assignment which only gives you a new handle to the _same_ array)... and it allows you to indicate when you want array or scalar context for functions or operators.

    Anyway, at some point (last decade, *eye roll*) someone (Larry) decided that since Perl can tell what kind of reference something is before dereferencing it, that the syntatic sugar that @ and % operators get should apply everywhere (so [] and {} both deference AND lookup, all the time). So all the ->{}/->[] groups can collapse... just like in other languages.

    But Perl can do this safely since it already knows what you're trying to do and won't let you do otherwise (using array lookup on a hash reference, for example).

    --
    THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
    1. Re:Incidentally... by chromatic · · Score: 2, Informative
      Because array is just an entry in a symbol table...

      Whoa, not for lexicals.

      ... so [] and {} both deference AND lookup, all the time...

      Nope, only after you've already dereferenced one level.

  32. Re:If you use PHP.... by cortana · · Score: 1

    An out of date practice. If a subverted process can write a file anywhere then it can save some perl/php/shell/python/scheme/etc code to a file and call the relevant script interpreter to run it.

  33. Re:If you use PHP.... by cortana · · Score: 1

    Erm, a non-conversation? If you want something that your host won't provide then take your money elsewhere!

  34. Re:If you use PHP.... by batkiwi · · Score: 1

    Yes, but you can read the contents of "not_a_worm.pl". You can't read a compiled worm which deleted its source on first run.

  35. Re:If you use PHP.... by jdray · · Score: 1

    How about Ruby?

    --
    The Spoon
    Updated 6/28/2011
  36. #include "sarcasm.h" by Anonymous Coward · · Score: 0
    Interesting, my order of preference would be something like:
    1. Perl
    2. PHP
    3. Python
    4. Pike
    5. Ruby
    6. Lua
    7. OCaml
    8. Clisp
    9. Scheme
    10. Haskell
    11. C#
    12. C++
    13. C
    14. Obj C
    15. javascript
    16. bash
    17. basic
    18. ASM
    19. Intercal
    20. Brainfuck
    21. Binary
    22. Java

    Anywayz, thanks for sharing cuz sharing is caring. LOL!

    Important Stuff * Please try to keep posts on topic. * Try to reply to other people's comments instead of starting new threads. * Read other people's messages before posting your own to avoid simply duplicating what has already been said. * Use a clear subject that describes what your message is about. * Offtopic, Inflammatory, Inappropriate, Illegal, or Offensive comments might be moderated. (You can read everything, even moderated posts, by adjusting your threshold on the User Preferences Page) * If you want replies to your comments sent to you, consider logging in or creating an account Problems regarding accounts or comment posting should be sent to CowboyNeal

    1. Re:#include "sarcasm.h" by windex · · Score: 1

      I love how Brainfuck hits the list before Java. 3

  37. Re:If you use PHP.... by brickballs · · Score: 1

    not to be spamy or anything, but I've compiled stuff on my dreamhost box before. They even gave me a sudo password when I asked politely. (In all fairness, I do have a dedicated server, and that might make a dfference.)

    And I've been with em long enough to have a good number of concerns (mostly my fault) and they were always very responsive. (And always helped me fix it.)

    If you're interested, http://dreamhost.com/ or http://www.dreamhost.com/r.cgi?95192 if you feel like being nice to me ;)

    --
    "What does slashdotting mean?"
    "You've never heard of slashdot?"
    "I know it makes websites not work."
  38. Real men... by Goaway · · Score: 1

    Real men program in PerlHP!

    1. Re:Real men... by thx2001r · · Score: 1

      Just looked over the PerlHP site... that's pretty sweet!

      Haven't tried anything in depth with this yet but have you heard about how it fares with mod_perl (as far as turning "query arguments and cookies into global variables", as stated on the PerlHP web site)?

      --

      -Joe
      If we're all god's children, what's so special about Jesus? - Jimmy Carr

  39. Re:If you use PHP.... by cortana · · Score: 1

    The worm can unlink not_a_worm.pl after it executes perl.

  40. Re:If you use PHP.... by chromatic · · Score: 1

    The post said Perl, not PERL. The latter isn't as capable.

  41. Re:If you use PHP.... by baadger · · Score: 1

    Why wouldn't they give you a 'sudo password' on YOUR dedicated box? Or do you mean a shared account? I'm not really sure I would want an account on a host that gives out root access willy nilly...even to those asking politely.

    That said I already have a Dreamhost account, cost me $10 for a whole year for their crazy domain insane plan, so it it's almost worth it for the laughs if they turn out to be total shizzle. So far no probs though...

  42. Re:If you use PHP.... by petard · · Score: 1

    Not if the worm author used B::Bytecode and deleted the perl source on first run. It'd be about as hard to read as a compiled worm. It's possible that more folks have the skills to disassemble and understand perl bytecode, but I'm not confident in that.

    --
    .sig: file not found
  43. Re:If you use PHP.... by ruckc · · Score: 0, Flamebait

    Sadly i have to admit that i use perl & php together...

    Perl's DBD for Postgresql has some issues dealing with oddly formed strings (even when properly quoted). PHP doesn't have this issue (even when the strings are unquoted). So i literally execute a php script on the CLI to perform insert operations. (The php script just reads a temporary file with the data needed to insert.)

    Yes this is hokey... but it works, and i didn't want to spend another hour or two figuring out why perl was having issues.

  44. Re:If you use PHP.... by Joe+U · · Score: 1

    That's like calling Commodore 64 BASIC inferior to Commodore 128 BASIC.

    OK, seriously, people, use the best tool for the job, anyone who tells you otherwise is a clueless idiot.

    Not every project requires the same language.

    e.g. Don't spend an hour writing a C++ program when a batch file can do the job in 5 minutes.

  45. Dear Slashdot, by edremy · · Score: 4, Funny
    I am trying to write a question that will get the maximum number of snarky replies. Taco didn't post my "Advice for converting a Ruby on Rails application to ASP.NET?" submission, so do you have another suggestion?

    Thank you
    A. T. Roll

    --
    "Seven Deadly Sins? I thought it was a to-do list!"
    1. Re:Dear Slashdot, by maxwell+demon · · Score: 1

      Maybe try "How can I use Emacs packages on vi?"

      --
      The Tao of math: The numbers you can count are not the real numbers.
    2. Re:Dear Slashdot, by wild_berry · · Score: 1

      Also, "Sides-stepping implementation bugs in XEmacs' Vi mode" should rile the Vi and GNU Emacs and XEmacs crowds...

  46. Re:If you use PHP.... by phenix927 · · Score: 1

    and just because you can don't mean you should. It's never a good idea to mix languages on any project. Try to explain this to a programmer.

  47. You shure you're a PHP developer? by Qbertino · · Score: 2, Informative

    There's like ten bazillion ways to integrate PHP with Image processing tools like Image Magick just like with any other OSS language. Only more so because the PHP userbase is largest. No need to use some Hack involving Perl. Typo3 (www.typo3.org) uses Image Processing to generate Menubuttons and stuff, there are countless other PHP projects out there doing the same, and it's no sweat at all to start the imagemagick CLI tools (contvert, etc.) including parameters from PHP. 30 lines of code max I'd say. Do you homework and then ask in some PHP forums and mailinglists for sample code. You'll get answers in no time.

    --
    We suffer more in our imagination than in reality. - Seneca
  48. Re:If you use PHP.... by Fordiman · · Score: 1

    Right. And of course, this means that the best way to write web applications must ALWAYS be to use Mono/JScript server side. Why? JScript is syntactically identical to ECMAScript (Javascript to you buzzwordy people).

    --
    110100 1101000 1101000 1100110 0 1101111 1101000 1100011 1
  49. Semi OT question by MobileTatsu-NJG · · Score: 1

    This question isn't all that relevent to the topic other than a brief mention of PHP. No hard feelings if modded off-topic.

    I'm a 3D artist working in the VFX industry. Recently, I've been scripting within my 3D app. (The syntax of this language is a lot like PHP...) There are a lot of things you can do with the scripting portion of the app. You can write modeling plugins that play with the geometry. You can write shaders. You can automate tedious tasks. You can work on the RGB buffers after they've been written. Etc. There was a rumor flying around that they were going to switch from the PHP'esque syntax to Python, the justification being that they can do much more powerful things with it. I'm unfamiliar with Python, so please forgive my ignorance. I just wanted to ask: Can anybody describe in laymen's terms what this sort of change could mean towards writing better/more efficient code? I'm almost afraid to ask this question for fear of starting a PHP vs. Python war, but I'm just curious if there's a significant difference in philosophy with this language or if the company making this app is just trying to follow in the footsteps of more successful apps that already use Python.

    --

    "I like to lick butts!" by MobileTatsu-NJG (#32700246) (Score:5, Informative)

    1. Re:Semi OT question by daveinthesky · · Score: 1

      Simple:

      A certain studio already has an implementation of this scripting interface written in Python for that same app you alude to (you have definitely heard of them). The mfg. of said 3D app has now resorted to stealing the better ideas from their customers. No joke! ;-)

      But, to answer your question, MEL is lacking lots of features that skilled developers (who might happen to like Python) happen to enjoy. And since blender3d already has a Python interface, they sure wouldn't want to lose the feature war to some OSS project (not to mention developer mindshare).

    2. Re:Semi OT question by daveinthesky · · Score: 1


      > this scripting interface written in Python

      correction: ...implementation of a Python-based scripting interface...

    3. Re:Semi OT question by MikeFM · · Score: 1

      Python can be something of a mind-trip if you've only used languages with a C-styled syntax such as PHP. The majority of the difference is in the lack of containing braces around blocks which is replaced by making whitespace meaningful. It works pretty well once you get used to it. Python is a terse language that doesn't make you spell out every little detail, such as Java or C/C++, and is strongly object oriented. I find Python easy to write and maintain for anything from a short script up to full-blown applications. For the most part it's a very clean well designed language.

      For short scripts it'd probably not mean much for you to switch from PHP (or a similar language) but for larger scripts the clean syntax and object oriented nature would save you a lot of work. The kicker being that you need to understand the concept of objects to work well in Python.

      --
      At what price learning? At what cost wisdom? The price is a man's peace of mind, and the cost is his life.
    4. Re:Semi OT question by SimHacker · · Score: 1

      Good languages are hard to design. Scriptable applications that dream up their own special-purpose scripting languages tend to have a lot of deep flaws and fundamental limitations. Most of the developer's resources go into the main application, not designing and supporting the scripting language. And special purposes non-standard languages usually don't have good development and debugging tools, either.

      Python is a very well designed language, with a huge active community and robust collection of tools and extension modules, which was designed to be used as a general purpose application scripting language, from day one. Its syntax is quite simple, and there aren't a lot of exceptions to the rules (like Perl) or subtle nuances and inexplicable quirks (like PHP), so it's quite easy to learn.

      One of the big upsides to using Python as an application scripting language is that all of the standard and add-on Python modules are at your disposal, and if you need to do anything specialized, you can write your own Python modules (using SWIG makes that quite easy).

      Why would you want to plug your own custom Python modules into a scripable application like Maya? You might want to call libraries that import and export content, and integrate existing i/o and previewing code from the applications that consume the content you're building in Maya. And if your other applications are also scripted in Python, then you can use the same code and modules in your application and your tools, which really rocks! Python on Windows also has full support for OLE Automation, so you can easily integrate applications like Excel, and ActiveX controls, too.

      But to stay on topic: Despite its crystal-meth-like popularity, PHP is an ameteurishly designed language, and has a long track record of each new version breaking compatibility by attempting to paper-machete over stupid mistakes of the past, that shouldn't have been made in the first place. But the difference between PHP and Perl, is that PHP is just naive, and didn't know it was making those mistakes. But Perl is totally malevolent, it chose to make all those mistakes on purpose, and it revels in its own fractal complexity.

      Sure, go ahead with your experiment to arrange a shotgun marriage of PHP and Perl. But beware: this could happen to you!

      -Don

      --
      Take a look and feel free: http://www.PieMenu.com
  50. Re:If you use PHP.... by Gulthek · · Score: 1

    Eh. Penny Arcade is on Ruby on Rails. It is slow, prone to crashing on update days, has a fair bit of broken code...all in all, not a winning endorsement for the framework or the language and its viability for large scale deployment.

  51. Re:If you use PHP.... by Fordiman · · Score: 1

    One Perl to rule them all
    One C to find them
    One bash to bring them all
    and in PHP bind them!

    --
    110100 1101000 1101000 1100110 0 1101111 1101000 1100011 1
  52. Re:If you use PHP.... by 0racle · · Score: 1

    Actually it's more like thinking there might be a poster with a sense of humour around here.

    --
    "I use a Mac because I'm just better than you are."
  53. Re:If you use PHP.... by Anonymous Coward · · Score: 0

    Since perl is a write only language, I don't know if that's neccesarily true.

  54. Re:If you use PHP.... by Anonymous Coward · · Score: 0

    It's never a good idea to mix languages on any project.

    It helps keep modules loosely coupled: write domain-functions and user-interface in different languages, and you'll find it easier to keep each funtionality where it belongs.

  55. Turck MMCache by rodent · · Score: 3, Interesting

    I have to say I used Turck MMCache on an 80 server farm serving up >4 million page loads (not hits) per day with not a single problem. This was back in the PHP4 days. Based on the load on the machines it could have easily been done with 5 but management wanted to spread the risk in an insanely large manner.

    --
    rodent...
    Tactical nuclear weapons are a viable alternative!
    1. Re:Turck MMCache by astanley218 · · Score: 1

      I just wanted to add my own success story to the MMCache thread. We routinely deploy MMCache in shared and dedicated hosting environments. Collectively our servers are handling page requests for over 1,000 domains, and after several years we have not had a single problem with MMCache. This piece of software is excellent and I would highly recommend it to anyone who is not using a PHP cacher already, and has the access/permission to install it.

  56. You want PHP in your perl by bfree · · Score: 1

    How about Catalyst-View-PHP.

    --

    Never underestimate the dark side of the Source

  57. perl php by Anonymous Coward · · Score: 0

    PHP would be a good tool, for a black man. 97% of negros have the P-H-Pizzle chromosome, while 97% of whites use more logical languages like Perl. The difference is clear in the supremecy of the language and its symantics. I fail to see a use for calling perl code from php. Let me make a simple comparison for you, when a white man goes into a bank, it must be to invest money to maintain his supremacy. While a black man starts gatt'n nigga's to clean the place out. The difference is clear, I don't wish you to agree with me. I simply wish you to see my point of view.

    White as always,
    GWB

  58. Congratulations by Anonymous Coward · · Score: 2, Funny

    Congratulations! You found the worst of both worlds.

  59. Re:If you use PHP.... by SlappyBastard · · Score: 1
    The main fault of PHP is that it lowers the educational cost of entry to the point that incompetent people can build functional but insecure code.

    It's not PHP's fault. As a language it is more than capable of delivering security and stability. It just happens to not be idiot-proof while being quite idiot-accessible.

    In that regard, its existence is no worse than the number of Windows machines running right now. Or for that matter, how many apps have been coded in Visual BASIC?

    I've done C++, Perl and some Tomcat stuff ... On the whole, it has been more worthwhile to take the time committed to those approaches and re-apply it tightening up PHP code.

    Now, that's a huge qualifier, I admit -- a lot of noobs aren't going to do commit that time.

    But, I think it's not necessarily the right characterization to blame a language for empowering stupid people. It's right to blame the stupid people.

    --
    I scream. You scream. I assume that means we're both acquainted with the problem. We proceed.
  60. Re:If you use PHP.... by mogabog · · Score: 1

    Dreamhost is AWESOME! I have been with them for a couple years and they are great and always giving new features. I wouldn't run something mission-critical on a $7.95 a month plan, but for email, blogs, non-traffic heavy sites, I would use them again and again.

    -A

  61. Re:If you use PHP.... by brickballs · · Score: 1

    It's dedicated, I upgraded from shared. I dont think they give out root for shared accounts. I'm not so sure I'd want that either...

    I was only on the shared server for a couple months before I decided I needed more power (They don't have a specific limit on cpu minutes, but some of my stuff was hitting the box prety hard.)

    Like I said though, they've always taken good care of me.

    --
    "What does slashdotting mean?"
    "You've never heard of slashdot?"
    "I know it makes websites not work."
  62. Re:If you use PHP.... by Anonymous Coward · · Score: 0

    Not found

    Whatever it was you were looking for, it's not here. This may be due to...

            * You made a typo in the URL
            * What you are looking for no longer exists on CPAN
            * You followed an invalid link. If this is the case, please inform the maintainer of the refering page

  63. Why not use http as your connector? by joelwyland · · Score: 5, Informative

    Why do you need them to work in the same script? Have your PHP generate an img tag that references the perl script in the src attribute. Then the web browser will fetch the image data directly from the perl script and you don't need a Frankensteinian monster.

  64. Re:If you use PHP.... by Anonymous Coward · · Score: 0

    ROFL. It's funny cuz it's true.

  65. Haven't you ever heard of that Loverboy song? by trentfoley · · Score: 2, Funny

    "Pearl and PHP DNA... just don't mix"

    1. Re:Haven't you ever heard of that Loverboy song? by trentfoley · · Score: 1

      Dam my drunken typing skills. Perl...

  66. Re:If you use PHP.... by TheLink · · Score: 1

    How are you quoting those strings? Are you using bind variables and "prepare"? If you are then its a bug in DBD.

    --
  67. Re:If you use PHP.... by Schraegstrichpunkt · · Score: 1
    It's a basic security best practice.

    Only if "basic security best practices" involve giving users a false sense of security.

  68. Re:If you use PHP.... by Dwonis · · Score: 1
    The main fault of PHP is that it lowers the educational cost of entry to the point that incompetent people can build functional but insecure code.

    Well, that's one of its problems, but that's hardly what I'd call its main fault. Though I use it quite a bit, PHP is not an easy-to-use language if you care about correctness, robustness or security. I have a webpage that lists, in point form, some of the criticisms of PHP that I have accumulated over the last few years. The page is about PHP 4, since that's still what my customers' systems are using, but some of the criticisms apply to PHP 5 as well.

  69. Re:If you use PHP.... by pingveno · · Score: 1

    I really, really hope you're kidding. Changing colors on mouseovers (aka hover) is part of HTML, CSS, and ECMAScript. PHP is great for generating HTML/CSS/ECMAScript, but any server side language worth its CPU cycles could generate the same effects.

    --
    "it's not about aptitude, it's the way you're viewed" - Galinda
  70. GD? by corychristison · · Score: 2, Informative
    May I ask why not GD? It's pretty mature and very usable in PHP. Most installations around the globe include GD2 so would it not be a more viable solution [especially if it's an open source project]?

    Just wondering. :-)

    1. Re:GD? by Chainsaw76 · · Score: 1

      I can't speak for the poster, I've been working on a project where I had to overlay text on top of a animated gif and output the merged animated gif. No way, at least that I know of, GD would handle it, and ImageMagick did it with very little fuss. I ended up using exec, since I didn't want to mess with perl.

      -Jason

    2. Re:GD? by gbulmash · · Score: 1
      1. GD does not handle as many file formats as ImageMagick, particularly not certain vector-based formats.

      2. GD doesn't offer as many "effects" as ImageMagick.


      It's as simple as that.

      As for why I don't wish to use exec(). Even the best programmer occasionally leaves an unintentional hole in his code, and if that hole allows a command to be smuggled into the exec statement, you can be in a lot of trouble. I am not the best programmer, so though I do try to validate within an inch of its life every variable that a user can pass or spoof, I figure it's best for me to avoid sending anything from my scripts to the commandline whenever possible.

      - Greg
  71. Quality and GIF by Phil+John · · Score: 1

    GD didn't support GIF files (legally) for a long time (you could always compile it in, but that meant nothing to people on shared hosting). Also, ImageMagick produced, in my opinion, better quality files at smaller sizes than GD used to.

    Of course, today, with no GIF problems and the quality on both about par, there's not a lot of difference.

    Our system offers a plugin based solution, use GD or ImageMagick with a single config file change. As far as calling ImageMagick from PHP goes, we just use the command execution functions.

    --
    I am NaN
  72. I've used both PHP and Perl. Advice: Don't do it. by mrjb · · Score: 1

    I've used both PHP and Perl for web development. I'd discourage mixing PHP and Perl in the same script, it's not necessary. Sure, it can be done, but just because it can be done doesn't necessarily make it a good idea. It will make your website harder to maintain, because whoever is going to maintain your website in the future will need to know both perl and PHP (granted, they are relatively similar languages).

    There is a clearly defined functional separation in this case, though. It would seem to me that you want to do your web stuff in PHP and your images in Perl. Write your image scripts in perl then; There's nothing wrong with generating in PHP. Perl people will be able to maintain your image scripts, PHP people will be able to maintain your web scripts.

    --
    Visit http://ringbreak.dnd.utwente.nl/~mrjb/growingbettersoftware to download your free copy of the book
  73. Re:I've used both PHP and Perl. Advice: Don't do i by mrjb · · Score: 1

    Okay, so slashdot doesn't properly replace brackets. That sentence ought to have been "There's nothing wrong with generating in PHP".

    --
    Visit http://ringbreak.dnd.utwente.nl/~mrjb/growingbettersoftware to download your free copy of the book
  74. Re:If you use PHP.... by maxwell+demon · · Score: 1

    And the Schrödinger Cat experiment is to write code which might be either Perl or PHP, but you don't know until you actually run it?

    --
    The Tao of math: The numbers you can count are not the real numbers.
  75. 7 languages in one program by hallvar · · Score: 2, Funny

    http://blog.sykosopp.com/2006/02/26/one-file-to-ru le-them-all/

    Embed all your languages, this file can be interpreted or compiled in 7 different coding languages:

    $ php poly.sh.pl.php.tcl.cpp.bf.py.c.lhs.txt
    #I'm a PHP script
    $ python poly.sh.pl.php.tcl.cpp.bf.py.c.lhs.txt
    I'm a Python program.
    $ perl poly.sh.pl.php.tcl.cpp.bf.py.c.lhs.txt
    I'm a Perl program.
    $ tclsh poly.sh.pl.php.tcl.cpp.bf.py.c.lhs.txt
    I'm a tcl script.
    $ sh poly.sh.pl.php.tcl.cpp.bf.py.c.lhs.txt
    I'm a sh script.

    Rename file to compile in C/C++:

    $ gcc p.c -o c;./c
    I'm a C program (C89 with // comments, trigraphs disabled).
    $ g++ p.c -o cp;./cp
    I'm a C++ program, trigraphs disabled.

    --
    Hallvar Helleseth (hallvar)
    1. Re:7 languages in one program by Anonymous Coward · · Score: 0

      Aren't all the symbols before the "I'm a Python script" line Brainfuck?

    2. Re:7 languages in one program by staed · · Score: 1

      Yup. And guess what? It outputs "I'm a brainfuck program." :)

      Try it here if you don't have a brainfuck compiler/interpreter: http://koti.mbnet.fi/villes/php/bf.php

    3. Re:7 languages in one program by rjshields · · Score: 1

      That's *lovely* but unfortunately completely useless ;)

      --
      In this world nothing is certain but death, taxes and flawed car analogies.
  76. Re:I've used both PHP and Perl. Advice: Don't do i by KiloByte · · Score: 2, Informative

    Using too many languages is bad?

    Hell, then a page of mine that uses all of:
    * bash
    * C
    * C++
    * Perl
    * perhaps even Python or some such (hell, I don't look under the pants of programs I call)
    * sed
    * grep

    And as far as I know, this is not a rare practice. If it's not a CPU-critical script, bash makes for good glue code. And you can't call it hard to maintain (at least until you look at sourceless configure scripts).

    --
    The creatures outside looked from Alt-Right to Antifa; but already it was impossible to say which was which.
  77. Question on one of those by SlappyBastard · · Score: 1
    The Session ID attacks: does anyone have a provable incident where someone exploited a session from Site A to act as a user on Site B?

    My understanding has always been this was a hypothetical set of attack.

    None of the problems you list on your site are that extreme. In point of fact, I use almost none of them (for example, I have my own function for XML parsing, probably a leftover habit from every other language where parsing was my problem). Every language has its issues (buffer overruns, too much file system access, etc.).

    --
    I scream. You scream. I assume that means we're both acquainted with the problem. We proceed.
  78. Re:If you use PHP.... by Anonymous Coward · · Score: 0

    Sarcasm, dude.

  79. Re:If you use PHP.... by nwbvt · · Score: 2, Insightful
    I'm not saying the language is completely useless (ok, I guess that was what I said in my last post, but that was intended to be a joke). I'm sure it is very useful for html writers who want to make a simple dynamic web page without learning how to program. The problem is that it teaches those people some very bad habits if they want to go into 'real' computer science.

    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.
  80. Embperl by EarwigTC · · Score: 1

    Meet Embperl

    --
    Promote civility: mod down any post starting with 'ummm'.
  81. Re:If you use PHP.... by Joe+U · · Score: 1

    It's never a good idea to mix languages on any project.

    Like for example, SQL and Perl. Wait a sec...

    Use the best tools for the job, sometimes multiple languages are needed.

  82. Re:If you use PHP.... by Joe+U · · Score: 1

    Actually it's more like thinking there might be a poster with a sense of humour around here.

    I would ask if you were new here, but your ID says otherwise.

    Besides, it's a well known fact that everyone with a ID under 500,000 has had their sense of humor brutally killed by the trolls. Well, except for Taco and company, they're laughing all the way to the bank.

  83. I'll buy that argument by SlappyBastard · · Score: 1
    "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."

    Fair enough.

    --
    I scream. You scream. I assume that means we're both acquainted with the problem. We proceed.
    1. Re:I'll buy that argument by aevans · · Score: 1

      No, not fair at all. Unless you give a "fairness" handicap for stupidity. What this guy is trying to do is use an existing application written in Perl in an existing site that was written in PHP. There is no such solution as "rewrite both the Perl application (MagickWand) and the website and likely other supporting libraries and infrastructure in a toy language like Python or Ruby -- which despite their cumulative fanboys' enthusiam, have never evolved the necessary community to support mainstream development."

    2. Re:I'll buy that argument by nwbvt · · Score: 1
      I know this is late, but RTFQ. It is very clear that he is building a new site, not working on an existing one that is already done in PHP.

      BTW, Python has a very large user base, especially when you consider uses other than web programming. Ruby isn't that small either, it just recently has become popular over here in the states (believe it or not, there are programmers in other countries like Japan as well). If you want to talk about a "toy language", you need to look no further than PHP, whose origional purpose was merely to make it easy to build personal webpages. And on the topic of the enthusiasm of fanboys, it is clear you really don't need to look beyond yourself.

      --
      Mathematics is made of 50 percent formulas, 50 percent proofs, and 50 percent imagination.
  84. Calling PHP from Perl by Dalfiatach · · Score: 3, Informative
    So you've got Perl in your PHP, is there a way to do PHP in your Perl?

    I am in the joyous position of having to maintain a monstrosity of an application that was written by at least 4 different programmers over a period of years with numerous kludges plastered on top of a highly dodgy initial design.

    A lot of the early code was in Perl. Obfuscated, unreadable, indecipherable (and uncommented) Perl. So I decided to re-implement whole libraries of functions in PHP instead. But...a lot of what goes on in the application is driven by 2 Perl daemons, and they needed access to the new PHP libraries too.

    So:

    use LWP::UserAgent;
    my $ua = LWP::UserAgent->new;
    $ua->agent("PerlApplication/0.1 ");

    #construct the url (including GET params)
    my $varstring = "http://localhost/perlcalls.php";

    # Create a request
    my $req = HTTP::Request->new(POST => $varstring);
    $req->content_type('application/x-www-form-urlenco ded');
    $req->content('');

    # Pass request to the user agent and get a response back
    my $res = $ua->request($req);
    print "PHPresult: " . $res->content;
    # Check the outcome of the response
    if ($res->is_success) {

    #parse content of response
    if($res->content eq "OK"){
    print "PHP returned OK";
    }

    }
    else {
    #system failure, PHP unreachable
    print "PHP Failure!";

    }
    --
    Day by day, the penguins steal my sanity
  85. Re:If you use PHP.... by ruckc · · Score: 1

    Yep, i setup the insert in a $dbh->prepare("INSERT INTO .... VALUES (?, ?, ?, ?);");

    and then i try a $sth->execute(@values);

  86. Re:If you use PHP.... by bombshelter13 · · Score: 1

    Only if you execute it, not if you open it up in $TEXT_EDITOR.

  87. Re:If you use PHP.... by cortana · · Score: 1

    The worm has already written the file and called perl to interpret it long before you noticed and got there with your text editor.

  88. Re:If you use PHP.... by chromatic · · Score: 1

    See? Completely less capable.

    Seriously though, I meant to link to PERL instead.

  89. Do they both need to be in a PHP script? by Schraegstrichpunkt · · Score: 1
    #!/bin/sh
    php <<EOF
    <?php
    echo htmlspecialchars("Hello world!\n");
    EOF

    perl <<EOF
    print "Hello world!\n";
    EOF
  90. PHP = PHthon = Python = Perlthon = Perl by SimHacker · · Score: 1

    Well you could use the PHthon PHP/Python bridge, then the Perlthon Python/Perl bridge.

    ...But what's the point of writing everything in one file but different languages? Why not write a pure PHP script that calls a pure Perl script directly? Or are you just looking for a way to avoid using more than one file, by making your application much more complex? Are they paying you by the hour, instead of for results, efficiency, simplicity, robustness, etc?

    Wasn't Parrot supposed to solve all these problems? Or was that just a sick joke that some misguided people too much too seriously?

    -Don

    --
    Take a look and feel free: http://www.PieMenu.com
  91. PHP => PHthon => ... by SimHacker · · Score: 1

    Thanks a lot, slashdot subject line filter. Those equal signs were suppost to be => arrows -- I didn't mean that they were equal (or ordered).

    -Don

    --
    Take a look and feel free: http://www.PieMenu.com
  92. More like Dog Shit and Camel Scabs. by Anonymous Coward · · Score: 0

    I take issue at your vile insinuation that pure innocent peanut cups which taste so wonderful and never hurt anyone, could possibly have any poisonous PHP or Perl in them!

    I throw down this gauntlet to defend the reputation of peanut butter cups! Dual at 11:00.

    -The Peanut Butter Cup Monster

  93. I was glossing over the details of lexicals... by Ayanami+Rei · · Score: 1

    That @foo and $foo are entirely seperate "slots" in the symbol table as far as Perl is concerned.
    But under the hood both @foo and $foo are both ARRAY refs, it's just that @foo has special copy-by-value semantics and array-context-when-lvalue-ness and other implicit connotations.
    And you're right (oops), yeah that first -> is required because then you have this ambiguity:

    my $foo = [1, 2, 3];
    my @foo = (4, 5, 6);

    print $foo[2]; ### Which foo is this?

    The answer being it's always '6', and this:

    $foo->[2]

    Is always '3'.

    --
    THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
  94. Re:If you use PHP.... by WuphonsReach · · Score: 1

    Personally I prefer Java Servlets, with perl a second place, then python, then bash, then C, then php.

    Right now I'm trying to figure out how to migrate away from IIS (we're debating what language / configuration we're going to go with...) which is VBScript. I've got Perl books, java books, maybe even some PHP books.

    I know that I'm not entirely comfortable with a move from VBScript to PHP (even though they're about equal in capabilities), plus there's the immaturity of PHP. Perl seems likely due to its maturity and I don't think I'll have a problem groking it. (I know C, C++, REXX, VB, FORTRAN, PASCAL, with exposure to half a dozen other application languages.)

    But where do you start with Java Servlets? (JSP?) I know, it's a lazy question, but why JSP instead of perl?

    --
    Wolde you bothe eate your cake, and have your cake?
  95. Yes there is by Tetard · · Score: 1
  96. Again with the PHP bashing... by Zaphod2016 · · Score: 1

    For your consideration: http://us3.php.net/manual/en/ref.image.php

    If you would like to see a simple script which generates a graph on the fly, help yourself to this.

    Yes, there are languages far more powerful than PHP. But, as I say EVERY TIME this flamewar goes down- are you sure you need them? As my grand-pappy used to say: why go deer hunting with a tank when a shotgun will do just fine?

    1. Re:Again with the PHP bashing... by Watson+Ladd · · Score: 1

      Because a PHP is a sawn-off shoutgun that will blow your foot off. Tanks don't do that.

      --
      Inventions have long since reached their limit, and I see no hope for further development.-- Frontinus, 1st cent. AD
  97. Re:If you use PHP.... by budgenator · · Score: 2, Insightful

    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
  98. Re:If you use PHP.... by budgenator · · Score: 1
    perldoc wrote
    $sth = $dbh->prepare("INSERT INTO table(foo,bar,baz) VALUES (?,?,?)");
    you wrote
    $dbh->prepare("INSERT INTO .... VALUES (?, ?, ?, ?);");
    the diference is your code that doesn't work, has the semicolon for the SQL statement in the statement, since prepare assumes that the statement is going to be submitted to the database, it adds the semicolon which would give your way two semicolons. I'm mostly MySQL thru PHP but I remembered this, probably because I made the same mistake myself and sweated bullets trying to find the problem; try it see if it works.
    --
    Apocalypse Cancelled, Sorry, No Ticket Refunds
  99. Re:If you use PHP.... by Achromatic1978 · · Score: 1
    except for Taco and company, they're laughing all the way to the bank

    Well, maybe, but not anymore. Accoring to CNN, Taco is someone who "doesn't matter anymore".

  100. Re:I've used both PHP and Perl. Advice: Don't do i by Anonymous Coward · · Score: 0
    If it's not a CPU-critical script, bash makes for good glue code. And you can't call it hard to maintain (at least until you look at sourceless configure scripts).


    How long before they let you out of the padded cell, anyway?


    I remember the bad old days of shell programming. There's a reason we stopped doing that, you know. Ask the nice men in the white outfits to explain it to you if you ever go-outpatient, will you?

  101. Job Security by Jerim · · Score: 1

    The only reason I can think of for a mish-mash of programming language is that you want to be the only person around who can figure it out. I have seen it done quite often in the IT industry. I personally don't agree with it, but it can be a very effective tool for making sure that you don't visit the unemployment office too often.

    If that is the case, then mix in everything that you can possibly think of. XML, PHP, Perl, put in some VBScript, maybe even javascript. Learn some Flash and throw that in as well, for some video or splash screen or something. Doesn't really matter what you use it for. If you are using a database backend, and chances are good that you are, don't just use one database. Use a variety of database programs, each with one table. That way you can make tons of database connections in the code and they will all look different. It will leave them guessing for years why you did it that way. (People will usually assume that you had a reason for doing it that way, even if they can't figure out why.) Just as long as the next guy to try and work on it can't figure it out. That way, you can sit by the phone and wait for it to ring.

    Now of course, if you are just trying to make an efficient streamlined program, then I would pick PERL as the language and go from there. You may find that PERL doesn't meet all your needs, and you can add in things as needed, but just keep it small. Oh, and don't forget to document everything. Chances are, that unless it is an overly easy application, you aren't going to remember everything.

  102. Re:If you use PHP.... by bxbaser · · Score: 1

    1 terabyte transfer per month for 9.95.
    I wonder what would happen if I signed up for 2 different hosts that advertise something like that and send a 1 gig file back and forth?

    for one would i even reach the 1 terrabyte limit ?
    for 2 how long till my account was shut down ?

    Anyone out there tried this ?

  103. Re:If you use PHP.... by brickballs · · Score: 1

    These guys actualy talked about that sort of thing. they said that they would loose money if a customer used up their full terabyte, but that because the vast majority of their customers use far less bandwidth they still honor their word even to the few that do.

    heres the quote:
    Imagine we didn't "oversell" at all. We still offer 20GB of disk space and 1TB of bandwidth on our $7.95/month plan because that's what the competition has forced us to offer. 1TB of bandwidth is about an average of 3Mbs. 3Mbs for a month costs us about $90/month. The 20GB of disk space actually costs us about $200 (BELIEVE IT OR NOT!), because of the level of availability and backups we provide. So, we'd be losing about $200 up front and $82 / month on each and every customer!

    And, all in the name of not "overselling", our disk arrays would sit 98% empty and our network pipes 1% full!

    It's worth it!

    What if you went to get a gym membership and they were like "We have a state-of-the-art facility with an elliptical machine, complete set of free weights, stairmaster, treadmill, yoga class, kickboxing, rock-climbing wall, and olympic sized pool.. per member! You'll never have to wait to use anything, anytime, seven days a week, 24 hours a day! Membership fees are $45,000/month with a $300,000 set up fee."?

    It's the same thing.

    But our "overselling" is even better then a gym's. At a gym, sometimes you're going to have to wait to use a machine. A machine you are PAYING hefty membership fees to use! That's not right.

    But with us, you really CAN use all the stuff we're offering. You won't be disabled for it. You won't have to wait. Your performance won't suffer. It's just a good thing for us there's a difference between being able to use something and actually using it!
    source: http://blog.dreamhost.com/2006/05/18/the-truth-abo ut-overselling/

    I have a 4 terabyte limit on my server, but I havn't ever exceded 2. I think theres only been two months where I broke 1 terabyte...
    but I've never heard a single other DH customer complain about being disabled for bandwidth. (they have forums that I browse occasionaly)
    --
    "What does slashdotting mean?"
    "You've never heard of slashdot?"
    "I know it makes websites not work."