![]() |
PHP vs Perl
I am becoming extremely frustrated with the limitations of the PHP language and would like to program in something else that has more power. I'd prefer Ruby but I need to be able to deploy it to people's servers and ruby is a bit difficult to deploy for the average webmaster. So I was thinking Perl might be a good choice since it a lot more common.
How common is it to have Perl run out of the box on most servers? Can the average webmaster set it up if he needs to? Is there any way to protect the code like IonCube or ZendGuard? It so frustrating being forced to use PHP all the time. I want something better but need to be able to work with everyone else in the community. |
What kinda stuff are you so frustrated about not being able to do in php? As far as web based stuff goes, i'd honestly say php is your best bet (i program in perl, php, ruby, etc..)
|
Ever consider Python ?
|
PHP scoping is probably the most annoying. Having to do global $myVar all the time.
$ and -> really make the code ugly. I prefer . to ->. $this-> is retarded. If it's not a local variable then it should check further up the scope to see if it's a class variable, or like ruby you can use @ or @@ to specify scope. Why do I need to stick a $ in front of all variables? That's just pure laziness of the language designer not wanting to complicate the parser and forcing that burden onto the coder. If it's not already in the symbol table or it's not any language grammar then it must be a variable. Duh. Sometimes you have to store something in a variable before you can access it as an array. You can't do gimmeaArray()[0]. You have to do: $tempVar = gimmeArray(); echo $tempVar[0]; Functions are second-rate citizens in PHP. They can't be stored in variables and can't be passed as parameters. It's just a pain to do a lot of things. |
there is nothing you listed there that can't be easily worked around.
$tempVar = gimmeArray(); echo $tempVar[0]; are you really complaining about a single extra line of code here?? If you are worried about variable scoping, store your shit in the superglobals so you dont have to do that. |
Here's what it comes down to for the most part. if you're NOT trying to build something that needs to handle mass amounts of traffic perl is GREAT, using it to build data is pretty usefull and it DOES have a DBI so you can even put that data into the DB.
When it comes down to being able to serve thousands to hundreds of thousands of pages a day that is where perl becomes a limp dick at an orgy... useless and out of place. Perl is more of a server maintanence type language. I would worry about learning ruby before bothering going BACK to perl. Perl is something I used a LOT 10 years ago but everything else has moved on and perl hasn't really. |
i really don't like php either but ...
Quote:
"Why do I need to stick a $ in front of all variables?" ... perl is not much different "Functions are second-rate citizens in PHP" ? ... huh? "It's just a pain to do a lot of things." ... sounds like you're just having a bad day and you're just working harder and not smarter ... Welcome to the wonderful world of programming. |
Quote:
|
Quote:
Quote:
Quote:
Quote:
|
What about Python?
|
PERL has a ton of modules as I recall, and most likely will not come installed out of the box.
Main problem with PERL is finding someone to work on it when troubles arise. |
I.. The.. buh..
I also am lazy and wish it was 1995 again; however, that's not built into my business model. |
Quote:
|
ha ha ha ha ha.. god.. yes.. perl will let you be a lazy programmer... but if you have problems with the way php handles variables you're going to just love perl and all the additional confusion it can lead to if you don't know what you're doing...
I use php for webpage stuff and perl for server cron tasks, large text file work etc. I don't think there's any way to encrypt perl but I haven't looked into that for years now. I've never seen perl NOT come installed on a server.. but there's so many modules for things available that if you want something special, it might need to be installed. |
I don't really feel like getting into a debate and trying to argue over how php should be, but i will say this, i don't think it's so much that php can't do what you want, or it's limited (and i do feel it's whack for you to hate php cuz your too lazy to use $ and $this, etc..), but it's more a matter of you not accepting the fact it's not LISP, or ruby, etc.. it's PHP, if you use it like it's intended, it's an EXTREMELY powerful and flexible language (especially as far as script goes), and i do wish we could use the return values straight from the function calls, ala getArray()[0], but that's hardly a reason to condemn any language.
In response to your original question tho, i doubt you'd like perl too much and as others have said, the day of perl and high traffic websites are pretty much over. I'd say stick w/ ruby (and rails), or maybe pick up python, you might like the way it is over php and it's a pretty righteous language in itself. Just saw the question of the deployment of python. I doubt python support in web servers is all that common, if your dealing w/ john q. public on shared hosting, etc.. Your pretty much fucked buddy, get over your fear of the extra typing and embrace php, use it like it's supposed to, love it, and it loves you back :1orglaugh |
Quote:
Quote:
Quote:
Quote:
|
Quote:
|
Quote:
|
I'd say stick with PHP, or try a little Python.
|
Quote:
|
Quote:
|
Quote:
happy programming ;) |
Quote:
|
Quote:
When you request a page from an Apache webserver, the request goes through several processing phases (authentication, logging,... the response phase). The response phase is what you work with when building a perl cgi script or a php script. It is the part of the process that generates the actual HTML page and returns it to the browser. Mod_perl gives you the ability to replace the default behaviors of any of these processing phases with your own phase handlers. Quote:
Quote:
Learning perl is hardly going 'back'. LOL |
enjoy
Quote:
|
Quote:
Also, hate might be a bit strong. It's just not the right tool for the job. No matter how I use a screwdriver it's just not going to work as well as a hammer for putting nails in a wall. I could do it with a screwdriver, but it's not ideal. Would require more effort and take longer. The language feels like a hack of things thrown together without much thought for their implication. When designing any language there is always a trade-off between how much effort it will be to write the parser/compiler and how much effort will be needed on the user's (coder's) end. Also, I think it is very rare that people will be able to understand what I am talking about because very few people know how to write a parser / compiler and also very few people are familiar with non-mainstream programming techniques such as closures, lambda calculus, and functional programming. For anyone interested, I suggest reading the book "Programming Language Pragmatics". You will have a much better understanding of the differences between the languages. Sure you can do everything in pretty much every language, but some let you do it a lot easier. Saying that's just being lazy is a poor rebuttal. Wanting to use a hammer when you're forced to use a screwdriver isn't laziness, it's because you know there's something better for that particular task. Using it like it's intended only works if PHP is suitable to what you are intending to do. I'm not talking about simple scripts. I'm talking about enterprise level stacks and frameworks that can integrate with each other. |
Quote:
I wish i used perl more, i've forgotten alot about it i'm sure, it just seems like most people use php now. I don't think i've actually wrote any perl (other then maybe fixing someone elses script) in like 2 or 3 years :/ |
Quote:
|
Quote:
As far as it not being able to be used for high traffic sites is a myth. It can, but it will take up more resources. Usually development costs are more than hosting costs so spending another $100 a month on hosting is better than spending another $10,000 on programming. But it's a choice you need to decide. Things can be developed faster in Ruby on Rails but most small scripts would be better written in PHP because Ruby on Rails is designed to do a specific thing well, if you're not doing that it doesn't help. Do a google for "can rails scale" and if you want more information. |
Quote:
A good language doesn't mean what you write will be great, it just means it has better capabilities. |
Quote:
http://www.gunduz.info/wp/wp-content...-mod_perl1.jpg |
I got a headache after this tthread
|
Quote:
Tons of people use languages because they're familiar, not because they're 'right'. Perl is what you had in the late 90s. It still exists. Should it be used by, oh, say, a bank? Depends on the task. Should it be used to parse XML? Depends on the task; there are many more robust libraries than those written to work with Perl, and if it's for a constant-state application, it should at least be saved in SHM so it can be executed without the disk overhead. Both PHP and Perl can be made to do this. Will a PHP person browse Google to find a pre-existing solution? Maybe. There's tons of shit that reimplement single functions in PHP with hunderds of kilobytes of code. Will a Perl person use what they find on CPAN? Fairly likely. It's on CPAN. Wait, where was I going with this? Delicious Apple Pie. Something we can all agree upon! |
Quote:
|
Quote:
So i guess i'm just saying i agree with you, if php isn't the right tool for the job, it's not. But just because it's 'enterprise level' stuff doesn't mean php isn't that tool. PHP can and is used at an enterprise level and probably is by now the most commonly used scripting language for web based stuff (i don't know if this is true, i haven't looked at the stats for this type of stuff in forever, if it's not #1 it's gotta be damn close). BTW, most of my experiance does come from programming more mainstream enterprise level stuff, i live, eat, and breathe php code for the most part, and in using it every day for the last 5 or so years i have yet to have any of my clients propose doing something web based that couldn't be done w/ php, and i would say that php accounts for atleast 95% of the programming that i do anymore. I've written parsing code (script parsing, data mining, and just about any other sort of parsing), as well as compilers, and many enterprise level applications. |
Quote:
|
Damn 3 minute edit time. Anyways, i'm bad at articulating what i'm thinking sometimes, i'm not hating on any language, it's all about using the right tool for what your doing, and no matter what your writing it in, writing good code. I'm definitley not saying php is the fastest, most reliable, etc.. these are pointless arguments because there are too many factors, i simply prefer it due to the fact it's not a pain in the ass like perl can be, and it's fast / reliable / flexible _enough_ to do what i'm required to do w/ it. I'll use whatever language is right for what i'm doing tho regardless of preference and i'd recommend anyone else doing that too.
|
Quote:
Quote:
|
Perl is fast, mod_perl etc are as fast if not faster then PHP when properly coded.
Perl is installed everywhere, if you find a *nix box that doesn't have it I'd be surprised. It's very cool, very awesome at processing text files, nice and flexible regexp native in everything. Don't under estimate Perl, it really is about the best language out there, just not the most structured OO/MVC setup in the world. Compiled C is also pretty cool, tho takes a bit more "noise" as you call it. -Ben |
Quote:
Your statements would indicate you do not "know what I mean" and you are not familiar with the terminology or concepts being discussed here. Your false statement that "ruby is a framework" indicates you are not well versed in languages and programming in general. Furthermore, saying "no thanks, I did my time with discrete math" is indicative of someone stuck in the ways of ignorance with no desire to change. |
Quote:
|
Quote:
|
Quote:
Good thread btw |
Quote:
|
:Oh crap
|
Quote:
|
Quote:
I'm not hating PHP, it's just that after you use other languages and get used to some of what they offer, it's a pain to go back to PHP. Many PHP programmers that learn Ruby feel this way. They don't want to go back because it feels like having to use a horse once you've driven a car. I've recently been studying compiler design and comparing a lot of different languages. I want to write my own language as an exercise. Actually, what I would really love to see is for something like Microsoft's dynamic language runtime or Sun's Da Vinci Machine project that can be written in any language and deployed to a server. Too many environments force you to use a language. They are going to compile to bytecode anyways, why not let you write your own bytecode in whatever language you want? The main problem is having a common open-source platform to deploy to. I've also thought it might be cool to implement a virtual machine inside of PHP so you can run bytecode compiled in other languages. Obviously not ideal for performance, but for backend admin tasks you aren't submitting hundreds of forms per second. |
Watching programmers fight is like watching chicks fight. LOL. Funny stuff.
|
its obvious you know a lot. good luck
Quote:
Quote:
Quote:
Quote:
breath... go for a walk, ... jackoff or something man. It's not that serious ... The most successful programmers are at the golf course. Not hacking code. Sorry about the misunderstanding, I'll just stick with my vic-20 and leave all the real shit to the professionals:thumbsup |
Quote:
|
All times are GMT -7. The time now is 07:43 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123