Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'd like to do it in perl, but my boss would like php. Ideally, I'd like to choose the language that would be best for the project. If I really want to do it in perl, he'll let me.
Obviously, this site is geared toward the perl gurus -- but seriously, are there advantages over doing it in php over perl? Which is more secure?
Will I have a difficult time since I've done almost no php?
The project is a simple web-iterface that takes in data, stores it in a mysql database. There is also an bidding/auction section to the site.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: perl vs. php
by friedo (Prior) on Nov 15, 2005 at 15:48 UTC | |
The main reason I avoid PHP though is the myriad security problems, lack of a consistent database interface, the habit of having a million functions in the main namespace with no particular naming convention or consistency, and the rather strange nature of PHP data types which allow you to mix hashes and ordered lists in a single structure. I understand PHP is making a lot of progress in these areas, though, so my concerns may be out-of-date. | [reply] |
by weierophinney (Pilgrim) on Nov 15, 2005 at 18:32 UTC | |
Caveat: I'm a PHP developer for Zend, and a lead author on several PHP open source projects. I'm also a perl developer. I use both languages regularly, though PHP more often than perl in recent years, due to the nature of my places of employment. I'm going to refute some points about PHP below, based on my experience with the language. From what I understand, similar things are available in PHP as well Yes, they are, including a PHP port of Cgiapp (that's a shameless plug), the Smarty templating language, the Savant templating language, and many others. In fact, regarding templating languages, PHP, in Rasmus Lerdorf's own words, was meant to be a templating language (Savant takes that approach, actually). There are number of frameworks similar in nature to Catalyst and CGI::Application out there for PHP as well -- Solar, Symfony, Cerebral Cortex, and Seagull, to name a few. PHP does not have the breadth of coverage that CPAN does This is debatable. The difference between PHP and Perl is that Perl has CPAN as a common repository. PHP has PEAR, but PEAR doesn't have quite the extensive library CPAN does. However, it does have some pretty rigid guidelines for contribution, one of which is that it (in recent years) allows duplication of packages only when the approach significantly differs, leading to what is hoped as 'best-in-breed' packages. Additionally, there are a number of other sites that are aggregating packages out there, including phpclasses. I'm betting that the number of PHP libraries out there is similar to perl's -- if in fact it hasn't exceeded perl's at this point. However, a key difference to note is that PHP is primarily targeted at web development. So the breadth and scope of packages for PHP is going to be significantly different than that for Perl. The main reason I avoid PHP though is the myriad security problems, lack of a consistent database interface, the habit of having a million functions in the main namespace with no particular naming convention or consistency, and the rather strange nature of PHP data types which allow you to mix hashes and ordered lists in a single structure. To this I reply: As for the OP, what it comes down to is: does it make good business sense for you to learn PHP at this time? If the project has a narrow deadline, and it's known that there will be Perl developers in your company for the forseeable future, it may not make sense; you're more familiar with perl and its libraries, and you'll be able to maintain the site more easily as you won't need to 'switch modes' between the two languages. However, your boss may have some particular ideas for why s/he wants PHP: cheaper, more plentiful developer base (though that may change); easier to find hosting should s/he decide to outsource the hosting (I see PHP on more shared hosts than perl); perhaps some business partnerships that would involve exchanging APIs and code. Do more research before you make your decision; but don't believe all FUD you hear about either language. | [reply] |
by friedo (Prior) on Nov 15, 2005 at 19:00 UTC | |
| [reply] [d/l] |
by emazep (Priest) on Nov 17, 2005 at 01:32 UTC | |
There are security problems in just about every language; perl is not immune to this.I would nevertheless say that Perl is somewhat more immune to security problems than PHP since, as I've already said in another message, PHP doesn't have a taint mode (contrary to Perl.) (I've heard about an attempt to provide PHP with a taint mode (PHPrevent), but I think that's at present more a theoretical study than a working extension.) Most security problems seen recently have less to do with the language itself as with bad programming practicesTaint mode is something that can help to detect and prevent such bad programming practices, and it is something that unfortunately PHP can't offer.
Ciao | [reply] |
Re: perl vs. php
by sauoq (Abbot) on Nov 15, 2005 at 16:33 UTC | |
are there advantages over doing it in php over perl? There is one big one that's probably more relevant from your boss's perspective than from yours. When you leave the project or the company†, it'll be a lot easier (and probably cheaper) to find a competent PHP developer who can take it over. Will I have a difficult time since I've done almost no php? It depends on you, of course. I do think that Perl programmers have a tendency to think of PHP as dysfunctional Perl and that tendency makes their learning curve slightly steeper. There are annoying syntax similarities‡ that sometimes disguise the fact that the languages are not at all alike below the surface. Still, it's an easy language to learn and you shouldn't have that much difficulty given that you already have substantial programming experience. If you do go that route, just try to keep in mind that PHP is not Perl. (Deja vu... I've said some of this before at Re: Perl is more intuitive.) The one thing that makes me pause is your description of this project as "major". I think Perl definitely has some (or, at least, can have some) advantages for a larger project, especially if you have more than a very small handful of people working on it. † More specifically, when you finally perish in a brief and tragic meeting with a runaway bus which is, as all management knows, the inevitable fate of anyone who becomes too familiar with the evil technical details of any project. ‡ Similarities that probably exist because PHP was originally a Perl program. -sauoq "My two cents aren't worth a dime."; | [reply] |
by Aristotle (Chancellor) on Nov 15, 2005 at 19:30 UTC | |
Et tu, sauoq? Makeshifts last the longest. | [reply] |
by sauoq (Abbot) on Nov 16, 2005 at 02:15 UTC | |
Et tu, sauoq? Now, now... I don't feel like I'm betraying anyone by telling the truth. There are droves of PHP programmers and, more to the point, they all do web work because that's what PHP is really for.† Even if there were just as many Perl programmers we are split among application, systems, and web development. Admittedly, there is lots of overlap... but that's part of what makes us more expensive. Yes, you can write standalone PHP scripts. No, no one does it. Not seriously anyway. I hope. -sauoq "My two cents aren't worth a dime."; | [reply] |
by Aristotle (Chancellor) on Nov 16, 2005 at 02:55 UTC | |
by sauoq (Abbot) on Nov 16, 2005 at 03:51 UTC | |
| |
Re: perl vs. php
by benrwebb (Scribe) on Nov 15, 2005 at 16:54 UTC | |
| [reply] |
Re: perl vs. php
by Perl Mouse (Chaplain) on Nov 15, 2005 at 15:47 UTC | |
are there advantages over doing it in php over perl?Yes, it makes your boss happy. But that's not a question you should ask here. And you shouldn't ask it on a PHP forum either. Not that I don't think their answers would be biased - they aren't useful for you. You don't want to do it in PHP - your boss does. So, ask you boss what the advantages are. It doesn't matter whether what he thinks are advantages are really advantages, but as long as he thinks they are, those are the arguments you have to deal with. Which is more secure?Neither. It's an irrelevant question. Programs are secure or not. You can write secure programs in any language (and it's difficult in all of them), and you can write insecure programs in any language (and that's surprisingly easy). Will I have a difficult time since I've done almost no php?How can we know? Some people pick up new languages in a matter of hours. Others are stuck in the first language they've learned, and will never become good in any other. You're not asking the right question - and you're not asking them to the right people either.
Perl --((8:>*
| [reply] |
by saberworks (Curate) on Nov 15, 2005 at 18:28 UTC | |
Neither. It's an irrelevant question. Programs are secure or not. You can write secure programs in any language (and it's difficult in all of them), and you can write insecure programs in any language (and that's surprisingly easy).That's not entirely true. Look at PHPs track record for PHPs security itself, not programs built with PHP. There have been numerous web worms and other types of malicious programs which are only viable because of functions in PHP itself that are vulnerable. They generally patch PHP pretty fast, but upgrading your own installation can be a headache when you have to do it every other week. | [reply] |
by emazep (Priest) on Nov 17, 2005 at 00:53 UTC | |
Neither. It's an irrelevant question. Programs are secure or not. You can write secure programs in any language (and it's difficult in all of them), and you can write insecure programs in any language (and that's surprisingly easy).That's not completely true (at least in this case.) Contrary to Perl, PHP doesn't have a taint mode, which is a deficiency of the language. Granted, you can still write secure programs without using the taint mode, but it can be much harder to detect the vulnerabilities of your code.
Ciao, | [reply] |
by Perl Mouse (Chaplain) on Nov 17, 2005 at 10:06 UTC | |
Perl --((8:>*
| [reply] |
Re: perl vs. php
by duff (Parson) on Nov 15, 2005 at 16:51 UTC | |
IMHO, once you know perl, it's easy to learn and use PHP proficiently. You'll need to keep php.net close at hand for all of the myriad functions you have at your disposal, but I think that's no big hardship. As far as which language is best for the project, it seems like your project would be just fine for PHP. Also, it seems small enough that it would give you a good opportunity to learn PHP and increase your "bankability" :-) If you have control over the systems where the application will be installed then it's a wash I think as to which language you should use. For a perl implementation you'll need to install some modules to interact with mysql. That's often a difficulty on systems where you have no control. For a PHP implementation, it usually comes with everything (including the kitchen sink) that you'll need so no extra installation. Oh, and as others have said as far as the languages go, perl and php are equally secure. It's all in how you write your code (and for php, in how you configure it). | [reply] |
Re: perl vs. php
by tphyahoo (Vicar) on Nov 15, 2005 at 16:30 UTC | |
A lot of that was surely drinking the kool-aid, but after waiting many weeks for the handel demo to come out I'm in a mood to do some flag waving :) | [reply] |
Re: perl vs. php
by nothingmuch (Priest) on Nov 15, 2005 at 16:45 UTC | |
-nuffin zz zZ Z Z #!perl | [reply] |
Re: perl vs. php
by Moron (Curate) on Nov 15, 2005 at 17:53 UTC | |
Although the beginner can get started faster with php than perl, there is a fixed limit to productivity with php. Perl is slower getting started because it has a wider capability that isn't packaged into a web-focused language, but which offers wider functional coverage and much higher productivity over the longer term. I would say it therefore depends on how committed your role is to web development. The more committed over the longer term, the more payback from taking the time to use perl to build up a more productive and flexible shop than is possible with php and which would overtake the php capability within a few months. But for a one-off short project, php is likely to get results faster. -M Free your mind | [reply] |
Re: perl vs. php
by talexb (Chancellor) on Nov 15, 2005 at 18:05 UTC | |
To me, this sounds less like a question about technology and more a question about psychology. So, why does your boss prefer PHP? It could be that it's a comfort zone thing .. the boss has looked at PHP examples and looked at Perl examples, and the PHP ones looked much clearer. Either language will be easy to maintain -- you can use Perl with a page templating system (like Template::Toolkit, the one I use) and make the source code look very PHP-ish. Frankly, it sounds like this is a simple enough project that you could do it in PHP no problems. If you've managed to learn Perl with any level of proficiency, I'm fairly sure PHP won't be much of a challenge. And, of course, once finished you could try doing the same project in Perl and see how much better it is. ;) Let us know how it all turns out. Alex / talexb / Toronto "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds | [reply] |
Re: perl vs. php
by RicardoPortilho (Novice) on Nov 15, 2005 at 19:05 UTC | |
| [reply] |
Re: perl vs. php
by Cap'n Steve (Friar) on Nov 16, 2005 at 04:52 UTC | |
| [reply] |
Re: perl vs. php
by nikos (Scribe) on Nov 16, 2005 at 02:32 UTC | |
| [reply] |
Re: perl vs. php
by kiat (Vicar) on Nov 16, 2005 at 03:00 UTC | |
Secondly, precisely because you already know Perl so well, you should consider PHP so you've an additional skill to market. Thirdly, it's always good to see things from the other side. Finally, choosing Perl over PHP goes against your boss' wishes, which may give the impression you aren't adaptive. Sidenote: I've coded a fairly extensive site in Perl. Recently, I did another site of a smaller scale in PHP. Because I was already familiar with some aspects of web logic, so it wasn't that difficult overall. I plan to try Python for a hobbyist site that I've been thinking of doing, just for the fun of it. | [reply] |
Re: perl vs. php
by kulls (Hermit) on Nov 16, 2005 at 08:20 UTC | |
my suggestion is php.comparing with money,project timelines,resources and maintenance you can prefer php and most likely its well suited for mysql too. Regards kulls. | [reply] |