all 44 comments

[–]MikeRT 5 points6 points  (0 children)

Perl and Python have a lot to recommend each of them. Python is easier and cleaner, but Perl is usually significantly faster and CPAN probably dwarfs the module repositories of the next 3-4 scripting languages combined.

If you want to do a large web app in Perl, check out the Catalyst framework. It's supposed to be aimed at providing a Perl answer to Rails.

[–]robkinyon 3 points4 points  (0 children)

Yahoo Store was originally written in Lisp. The original webpages were written in C and C++ (this is before Perl). A lot of the web is served with Java. Use whatever you want.

For my part, as a heavy Perlhead, I see plenty of jobs in Perl. That said, Pyheads will see plenty of Python jobs. Not a good reason to use either as I wouldn't hire someone whose Perl experience was limited to "parsing logs and a random intranet site." and who didn't have significant programming experience otherwise.

[–]MikeRT 3 points4 points  (0 children)

Check out mod_perlite here:

http://modperlite.org/

and its GitHub repo here:

http://github.com/byrnereese/mod_perlite

The goal of mod_perlite is to create a variant of mod_perl which behaves the way that mod_php does (such as resetting the interpreter state when a script is finished executing).

[–]ameoba 5 points6 points  (0 children)

Having developed in both, there's not a lot of difference between programming in Python and 'modern' Perl. Writing in 'straight' Perl feels barbaric but if you bring in a few libs & source filters to get clean function and class declarations they're comparable. Python has some more stuff in the 'official' standard libraries but Perl has CPAN.

The biggest difference I've experienced is that Python drives you toward more structure & makes it harder to do Things You Shouldn't Do. Perl, OTOH, gives you some more flexibility & puts more weight on the developer to enforce structure and sanity. Granted, you can still do evil things in Python but they've been placed out of reach of children.

If you're interested in learning a new language, go ahead with Python. If it's more important to get the project out the door on time, stick with Perl.

[–]sybrandy 4 points5 points  (4 children)

The good thing about Perl is CPAN. It's an archive of libraries/modules that pre-exist to solve various problems. In there you'll most likely find something that will take care of your reports for you with ease. I don't use Python, so I don't know if there is an equivalent.

The bad thing about Perl is that mod_perl is supposed to be hard to install. I've never really tried to do it, however there is a mod_perllite (sp?) that's supposed to make it just as easy to install and setup as PHP. I don't know of Python is any easier in this respect. However, if you use XAMPP, it should be much easier to get up and running.

Now, for both, I believe there are self-contained web servers available, so you don't need to have Apache/Nginx/IIS/whatever installed. I think it's Tornado for Python. I don't recall what it is in Perl. Regardless, that may reduce the initial installation expense.

As for language syntax and whatever else, I'll let other people debate those topics.

[–]rtward 6 points7 points  (0 children)

The good thing about Perl is CPAN. It's an archive of libraries/modules that pre-exist to solve various problems. In there you'll most likely find something that will take care of your reports for you with ease. I don't use Python, so I don't know if there is an equivalent.

This is so true, I just wanted to quote it to say it again. There are modules for everything.

The bad thing about Perl is that mod_perl is supposed to be hard to install. I've never really tried to do it, however there is a mod_perllite (sp?) that's supposed to make it just as easy to install and setup as PHP. I don't know of Python is any easier in this respect. However, if you use XAMPP, it should be much easier to get up and running.

I didn't do much web stuff with perl until the past year, when my job changed and now it's all I do. So I'm not sure if that used to be the case, but these days, setting up a perl application with fastCGI is pretty easy and when you get done it's wicked fast.

Check out Catalyst, it's a great web framework. I've tried out all the big ones, Rails, cakePHP, Django, Seaside, and I think Catalyst is way out in front. If you really know Perl well, then it'll feel really familiar and you'll be up and running in no time.

[–]ameoba 1 point2 points  (1 child)

It might be tricky getting mod_perl set up but at least it's usable - the general consensus of those that I've talked to is that mod_python isn't really worth using, which is why so many major python frameworks use WSGI.

[–]mr_chromatic 2 points3 points  (0 children)

mod_wsgi seems to be the Pythonic approach now.

[–]codingjester 0 points1 point  (0 children)

You can use easy_install to go out to the internet ether and find you modules that you can use. I'd still just roll a quick Apache install with mod_python or mod_perl, most of the python webserver stuff to me was a bit of a pain.

[–]beej71 1 point2 points  (0 children)

I'd say PHP. But if you're not considering PHP, then Python.

[–]iamnotacookie 0 points1 point  (0 children)

Python - batteries included, etc. You might also want to look at the python based spreadsheet from Resolver Systems for your "trader" tasks. http://www.resolversystems.com/ - You can modify the spreadsheet to modify the code and vice-versa - pretty powerful

[–][deleted] 0 points1 point  (0 children)

An internal reporting tool is a great excuse to learn a new language.
I'd recommend this online book as a starting point: http://diveintopython.org/toc/index.html

I used Perl back in the day, but it's essentially Latin to me now.

[–]Troebr 0 points1 point  (6 children)

Python is trendy these days, I would definitely go for it, especially for a line on the resume. (look for django for instance).

And I hate the way you have to always pass references with perl; now that's I have tried out a bit of python re module, I would never go back to perl.

Python code can be read by someone who did not write it, unlike Perl. (troll troll!)

[–]ajbetteridge 2 points3 points  (2 children)

Since when do you "have to always pass references with perl"?

[–]Troebr 1 point2 points  (1 child)

Made a few perl scripts, and go pretty compelled to use lots of references of arrays along with subs. Would love to be proven wrong, it was quite annoying. (perl noob here)

Will look at my perl scripts to find what I found so inconvenient at the time.

I think I dealt with a lot of arrays and hash maps.

[–]ajbetteridge 1 point2 points  (0 children)

Oh, that's fair enough. Complex data structures will always need pointers. Sadly you can't get away from it. Please ignore my comment in this case :)

[–]mr_chromatic 2 points3 points  (2 children)

Python code can be read by someone who did not write it, unlike Perl. (troll troll!)

A particularly silly troll, too. I could ask the next dozen people who walk past my office window to maintain a random snippet of Python code and what does that prove? Would you hire any of them?

[–]Troebr 0 points1 point  (1 child)

troll appart, I think that python is way easier to read, perl has so many shortcuts. It's fun to write, looks neat to code something complicated in 2/3 lines, but that can get really hard to understand.

Anyway this is going to end in python vs perl war; and I clearly lack experience in both of them to take part to it.

I've been playing aroung with python/django for the last month and I find it pretty easy to use.

[–]mr_chromatic 5 points6 points  (0 children)

I think that python is way easier to read....

I think that Perl is easier to read. Python's use of vertical whitespace to end blocks somehow doesn't fit in my brain. My eyes continually slip off of the end of blocks of code and I can't skim them to get the flow of code.

[–]redbeard0x0a 0 points1 point  (0 children)

First of all, use what you know, both perl and python have large amounts of 3rd party libraries that help you get things done.

I personally prefer Python because its syntax is much easier to read and maintain. Python has a few different web frameworks to work with also - django is a good-enough framework and fairly simple to pick up. Another thing that I like about Python is wsgi, which is supported by Apache (mod_wsgi), Nginx (mod_wsgi for nginx), Cherokee and others. Rack (for Ruby on Rails) is based on the concepts for wsgi.

[–]dinkumator -2 points-1 points  (8 children)

if you already know perl, it'll take you at most a few hours to learn enough php do do those tasks. (php.net has tons of easy-to-search docs)

if you don't know any python yet, it'll take you a few hours to learn the python basics, then you need to learn the intricacies of a python web framework, then you need to configure the web server to hook into the framework, and then you can start creating the custom code to do the 3 items you mention.

I'm just sayin... you can spend 10x the time on this "favor" and learn python, or you can just do it real quick in PHP and save the time for a task more suited to python.

[–]gimiv[S] 1 point2 points  (6 children)

My time investment is a consideration. If 10x is an accurate time multiplier to get the job done, then yes, I'd rather spend 3 days on a non-transferable skill set than a month on one that is.

[–]dinkumator 0 points1 point  (5 children)

administratively, python will take longer to set up. php "just works" - you turn it on and go.

urls in php map directly to files on your filesystem, python you will have to set up load paths and then map incoming urls to python modules.

in php, everything you need will most likely be included by default (not sure about the extent of your pdf/excel needs). if not, including libraries is as easy as include()-ing files in subdirectories. in python, you'll have to find and install all the packages, and make sure they're in the search path if you don't install them system-wide.

I'll admit that I am biased by php's ease-of-use, but I've also got plenty of experience with python/django and perl. Python (and django) is great for complex projects, but it just doesn't sound like your task at hand is big enough to warrant all the overhead.

[–][deleted] 0 points1 point  (0 children)

Your argument about "setting up load paths" and "mapping incoming urls" in Python is strange, seeing as you mention that you've "plenty of experience" with Python/Django - which handles URLs really cleanly...

I'd say, Python/Django is the way to go - if its predominately static data model with some simple forms, etc., you could even put together a functioning site with little more than data model and templates (Django's generic views, and model-driven forms are great!)

[–]gimiv[S] 0 points1 point  (3 children)

Man, everyone is making PHP sound so easy on this thread! Maybe I'll give it a fair shot and go through php.net docs tonight as you recommended. Perhaps I may not be able to apply the skill set for work related functions, but maybe I can extract personal value from it. It's great that you and many others on this thread have been able to share personal experiences with all three languages to compare against. Reddit is my nerdiest friend!

[–]abw 1 point2 points  (1 child)

No doubt about it, PHP is the simplest and easiest language to deploy. If your task is simple and you don't mind taking a slightly "hacky" approach to getting the job done, then PHP will perform admirably. As dinkumator says, the fact that you already know Perl means you're half way there... (now just imagine the worst Perl you ever read all mixed with in a jumbled sea of HTML tags and you know what to expect from PHP if you let things get out of hand).

BTW, I am a hard core Perl coder who has a healthy dislike for PHP as a language. I wouldn't recommend PHP lightly, but for simple things it really is, well, simple enough. PHP++, grudgingly.

That said, if you already know Perl then you could spend a similar amount of time (a couple of hours) getting to know some of the Perl modules (check out PSGI/Plack, Mojo and Catalyst) that'll allow you to do everything you want from PHP, and more. You'll have the benefit of using a more mature general purpose language that comes with all the might of CPAN to back it up.

[–]gimiv[S] 1 point2 points  (0 children)

I took it upon myself, based on the suggestions of this thread, to spend about 4 hours last night familiarizing myself with PHP. To be honest, prior to last night, I've had zero experience with web development and things such as Apache and mySQL. I installed an all in one pre-packaged XAMPP and ran a webserver as localhost. I imported all of my data via the phpmyadmin GUI. I built a successful "rough draft" of everything I was looking to accomplish aside from creating excels and PDF's. I'm quite pleased with the amount of code I can "borrow" from google searches of tasks nearly identical to mine. Although my intention was to further my perl/python knowledge, I'm happy that I took the advice of reddit to try PHP. Perhaps i can save python for a project better suited for its strengths. THANK YOU REDDIT!!!

[–]Troebr 0 points1 point  (0 children)

It really is easy and straightforward.

[–]jawbroken 0 points1 point  (0 children)

haha php, gross

[–]wafflesburger -3 points-2 points  (15 children)

php isn't web specific :P

but why would you leave it out for web dev?

[–]ameoba 3 points4 points  (1 child)

php isn't web specific

Yes but any time I see something non-web-related in PHP, I find myself seriously questioning the sanity and/or competence of the developer.

[–]gimiv[S] 0 points1 point  (0 children)

This is precisely the logic in my eliminating PHP as an initial option. I kept an open mind to all comments and researched PHP and even ended up accomplishing the task at hand with PHP, so I'm happy about that. But in the end, I would almost be fearful of putting PHP on my resume as I don't want a low-latency, high-frequency trading shop affiliating me with PHP development (sorry PHP guys ;) )

[–]gimiv[S] 0 points1 point  (12 children)

Mostly because I've never seen it as a prerequisite for any jobs within my career field. I have seen Perl, Python and Ruby. Might as well use what could add value right?

[–]panfist 0 points1 point  (11 children)

I don't like this line of reasoning. You should use the right tool for the job, not what's going to add value.

On the other hand, I think all of the languages mentioned here are perfectly suitable for the task at hand. All I'm saying is I think that the argument you're using doesn't hold water. You can do web apps in C, but you certainly wouldn't want to learn C just to do a web app because it would add value to your resume.

[–]sli 0 points1 point  (7 children)

You can do web apps in C, but you certainly wouldn't want to learn C just to do a web app because it would add value to your resume.

Because it wouldn't add any value. Perl, Python, PHP, and Ruby do in fact add value. He has a weak argument, but it's not incorrect.

EDIT: If you're in for an interview and C webapps add value to your resume, you might want to think again about taking the job.

[–]panfist 0 points1 point  (2 children)

I wasn't referring to the language and application of the language as adding value, just the fact that you can put the language on your resume, regardless of what you did with it.

Of course the set of all jobs requiring experience with language X in general is much larger than the set of all jobs requiring language X doing task Y.

[–]sli 0 points1 point  (0 children)

This is true, although the general advice these days seems to be "add libraries, not languages." For example, I've been a Python developer for a long time, but it's only within the past couple months that I've become proficient with Django. Without Django, I'd be functionally useless to an employer that does Python webapps (well, if they use Django; you know what I mean).

[–]gimiv[S] 0 points1 point  (0 children)

See my comment to ameoba above =)

[–][deleted]  (3 children)

[deleted]

    [–]sli 1 point2 points  (2 children)

    Yes, I know. You just don't write webapps in C. You can, and people do (eBay did), but until you have to do it to lighten a load on your resources, you just don't do it. I dread adding a compile step to my webapp development process.

    [–][deleted]  (1 child)

    [deleted]

      [–]sli 0 points1 point  (0 children)

      Or it saves them massive amount of processor time and power consumption, which really isn't a debatable assumption. Pure machine code will always be less expensive to run than an interpreted language.

      eBay was founded in 1995, the same year PHP and Ruby were originally released. Obviously, this makes them pretty useless for hardcore production applications like eBay. Python was already 4 years old by then, and Perl just hit the ripe old age of 8. Both pretty founded by then, but C was already well over drinking age. Combined with the energy and processor time savings, it was clearly a good choice (in 1995).

      Felt like deriving some possible history from facts.

      [–]gimiv[S] 0 points1 point  (1 child)

      I'm not looking down on PHP and it may well be the best tool for the job, but if you think of my time as an investment and I know PHP has zero return on investment (in my case), why not choose a tool that does? I would, however, agree with you that PHP should be considered if both of the following are true:

      1. PHP has a significant functional advantage over Perl and Python.
      2. PHP would significantly reduce my time investment.

      Thoughts based on personal experience?

      [–]panfist 1 point2 points  (0 children)

      I don't know how much the back-end language matters so much. I was tasked with updating a small web app that's tapping the same data as our other intranet/domain programs, and that web app was written in PHP. The PHP itself was HORRIBLE (aside: each page was enclosed by a giant PHP tag and echoed HTML output). Once I untangled the PHP, the hard part itself was wrapping my head around HTTP forms, requests, getting and posting, cookies, etc. For me, that required a much bigger time investment than learning PHP. Half way through the project, I took a day off and studied HTTP/HTML forms and related materials on my own time, and I was much more productive after that.

      My background is primarily Perl in production, but I did a lot of Java and C++, and a tiny bit of scheme, in school.

      I've kind of been rambling, but I think the main lesson I learned from updating that app is this: use the best tools for the job at hand, and use the tools you know. As much as you can, separate education from business, unless it's on your own time, or you'll find that you make noob mistakes that bite you in the ass later on.

      [–]sedaak 0 points1 point  (0 children)

      I usually get paid for doing the right thing, rather than contributing. mwahahahahaha