I am currently in the process of designing a database-driven website to manage various personal data and some business data. This is primarily a personal app, however it will be used by a few clients to retrieve and update information. Is Perl still a viable language to code a website with the newer .NET options, Python, etc. available?

+26  A: 


Perl is well suited to rapid, incremental development. It supports CGI and REST quite easily; in my experience SOAP is a bit more difficult but not overwhelmingly so.

Make sure you use -w and strict with great diligence though! Also, in my experience, it really helps to develop and test one small feature at a time.

-w/strict takes a performance penalty. You can remove this when code has been promoted to production.
Don't believe spoulson's rumormongering. There is no performance penalty to warnings unless you hit them, and none to strict at all.
I prefer use warnings to -w
Brad Gilbert
+21  A: 
Josh Millard
It just has alot more competition now.
Matthew Watson
Sure, but competition isn't what undercuts the viability of a language. Abandonment and stagnation, those or the problems you worry about. Competition is as much as anything a helpful stimulus to the languages, and language communities, vying for attention.
Josh Millard

I don't see why not. I mean as long as you follow standards and write efficient code.... But we all always make sure to do that right?!

+13  A: 

Catalyst is a rails-like framework for Perl that is fairly popular now. If you decide to use Perl, it would be worth looking at.

Catalyst is more flexible and scalable than Rails.
+11  A: 

Any (reasonable) language you're confident with is viable to code a website with.

Perl has all the libraries you could dream of, and a mature community. No reason not to go with it.

Many viable languages are not really viable for web development. I'd never advise using C, C++, or FORTRAN, for instance.
Hence the second part of the anwser. Thanks for trying to read the whole of it.
+42  A: 

Perl is certainly a useful web development language. Check out the Mason Perl templating system and Catalyst which provides an MVC web framework.

Michael Ridley
And Template Toolkit!
+19  A: 

Well, assuming that perl can still create tags and text to send to a client request, then yeah it is. If you want a state-of-the-art application platform, there's Catalyst and Mason

+1  A: 

There's still a ton of legacy code that runs Perl which will keep it in use for a long time, but for new projects, it's not really the leader. I've been writing Perl every day at my job for 10 years now, but I would seriously consider using something else on a new project.

If you do decide to use Perl, I would recommend you pay attention to some of the more modern utilities and frameworks that bring Perl closer to the more hip languages. For example, take a look at Catalyst for a web framework. There's also a lot of resources that have cropped up recently for test-driven development in Perl that bring it in line with current practices.

+34  A: 

Perl is (and will always be, in my opinion) a viable language for web development. It's a language that once you learn, you'll be able to use anywhere.

For instance, I've used it for Web Development, System Administration, and personal projects.

There is a wealth of material available, as well as the Perl Monks website. All Perl tools are 'free' (as in speech and as in beer). You don't have to buy an Integrated Development Environment to get anything done (ASP.NET)), and you don't have to worry about a specific package being loaded, since Perl is readily available to most (if not all) webhosts.

The downside is that it's easy to create insecure websites, and the onus is on the developer to secure his website -- Perl isn't 'easy' to learn by any means, but the rewards are well worth the effort.

If money is no object, I'd suggest ASP.NET MVC, since you could utilize the power of Microsoft's Visual Studio, which is free.

All in all, it doesn't matter what language you use, but what you're comfortable with. I started with Perl, and migrated to C# and ASP.NET, and later to ASP.NET MVC, but I still use Perl on a (near) daily basis because it makes doing certain things very easy.

Career wise: LAMP (Linux, Apache, MySql, Perl/PHP) is a good move -- it's a niche market, but if you know PHP/Perl you'll be set. PHP is more on the upswing than Perl is, however.

So, to answer your question: Either devote your time to learning ASP.NET, C#, and SQL Server 2005; or devote your time to LAMP (PHP or Perl), if you're going to make a career out of it.

George Stocker
so is learning mason, catalyst and template toolkit not a good idea then?
You must walk before you run. Learning the toolkits mean nothing if you don't know Perl.
George Stocker
> The downside is that it's easy to create insecure websites, and the onus is on the developer to secure his websiteYou probably didn't mean it, but when I read this for the first time, I thought you are implying that "it's easy to create insecure websites" using Perl.Creating insecure websites is possible in any language. Using/learning good development practices is necessary to avoid such mistakes.
Prakash K
It is shockingly easy to create an insecure website with Perl. That isn't a fault of Perl; but it is something to be aware of.
George Stocker
+5  A: 

Perl has been processing web applications since the begining through CGI. the community is still strong with tons of libraries. check out CPAN

+29  A: 

Yes, Perl is still a very viable web language. I know a number of Perl startups that are doing quite well, thank you very much. And as a job market, while Perl is behind PHP, there are more Perl jobs than Ruby and Python combined. See Comparative Language job trend graphs for proof.

A standard Perl stack would be to use Catalyst for an MVC framework, with Rose::DB::Object or DBIx::Class for an ORM solution, and any of a number of templating solutions, with Template Toolkit being one of the most popular.

+8  A: 

As a language, I prefer Perl over PHP, but IMHO Perl hasn't been the strongest in web. Your architectural choices are basically three:

  1. CGI: easy to get started with the CGI module, but it's slow and rendering code can get ugly.
  2. mod_perl: Close equivalent to ASP.NET's ashx handlers. You'll get the best performance this way.
  3. Classic ASP/IIS: ActivePerl installs Perl as usable script language in ASP via page header: <%@Language="PerlScript"%>. Accessing the Request/Response objects can get weird and inconsistent due to Microsoft's implementation that VBScript hides from you.

There are plenty of frameworks you can learn, but they're usually an overlay over #1 or #2. If you want to go this route, take a look at Catalyst and Maypole.

A 4th option would be to use FastCGI. Speed-wise it sould be comparable to running under mod_perl, without being tied to a specific web werver (Apache).
True. I knew I forgot one from the list. In fact, mod_perl has a FastCGI-like configuration (Apache::Registry) that allows CGI apps to run and stay resident for the next request. It's a great compromise of CGI and mod_perl features.
Apache::Registry is _not_ like FastCGI. FastCGI is basically the same as a mod_perl-enabled Apache without any hooks into Apache itself.
Dave Rolsky
I'll leave that distinction as an exercise to the reader.
Yah, FastCGI + a rich framework like Catalyst ought to be considered the gold standard for Perl web development in 2009.
Agreed. After recently building a site in PHP, I'm strongly considering Perl again for *nix-based web development. I'm about to string myself up after using this antiquated language.
Maypole is no longer maintained. Catalyst is state of the art.
+3  A: 

For something mostly personal, the question isn't is Perl viable (it is) but whether you enjoy working with or want to learn it.

When I start learning new languages, I try them out on personal projects first. Perl is used fairly extensively at work, but my boss would probably balk if I suggested using Lua in addition. So the sort of project you are suggesting would be an ideal place to try something new.

Jon Ericson

I developed web apps in both and Perl. For a state-less app, basic Javascript, no AJAX, presenting some simple processing output Perl is surely the winner.

But I don't know any serious company (> 1 000 empl.) that would create their web-sites in Perl. Perl projects are simply unmanageable beyond certain point. I'm stressing serious here, because of course even big fish out there can make mistakes, which I'm sure will be pointed out to me in the comments ;)

There's a reason why the most sought for developers are in Java and C#.

The financial companies use Perl big time. The one I work for has much more than 1,000 employees and they use EmbPerl.Also is built on top of Perl. Arguably the guys running it are not > 1,000 employees, but it gets much more traffic than a typical company website.
I too have seen lots of large companies using (and continuing to use) Perl for business critical apps. my experience Perl isn't better or worse, than anything else for large projects. It's the developers that need to be good!
I believe the BBC is one of the larger Perl employers in London, and they have a whole mass of web applications, mostly internal, for their content management. And they have a lot of content to manage!
Perl is also the language of choice, when you have to connect old databases to new web-servers.
Brad Gilbert
You probably just don't know enough big companies. Seriously, how many have you visited or worked out that allows you to make such a generalization?
brian d foy
if you code perl like you would a sys-admin, then yes, it would be unmanageble after a certain point, but if you follow best practices and a bit of abstraction, you can make code that is just as good as any other content management system.
The corporation I work for has over 300,000 employees and we use Perl extensively for internal web based applications
I work for a company with over 1,000 employees, and we use Perl (mostly) for a mission-critical SaaS system which is one of our primary products.
$0.02: I've spent the last 15 years on wall street. All the Big Financial firms make very heavy use of perl. There's a lot of other stuff as well, but I haven't come across an initiative to move off of the language at all.
Michael Wilson
The BBC use Catalyst for the iPlayer
+7  A: 

Perl is a great language for doing this kind of thing.

A lot of people are telling you to use a module for this project, like Catalyst. You should definitely look into those things.

When people start doing HTML in Perl, they typically follow this pattern:

  1. lots of ugly print() statements
  2. lots of ugly <<HERE docs
  3. Use of a templating module (I like HTML::Template myself)
  4. Use of a framework.

You don't necessarily need to go to 4 on this project, but it would be great for your development as a programmer to skip 1 and 2.


Personally, I believe PHP is a better language for web development. My main reasons are the better OO support, as well as PHP itself being used as a template engine.

Perl is nice, and I use it quite often for cron jobs and system administration. But, in my opinion, the OO syntax is clunky at best, and you cannot use it as a template engine out of the box.

Bottom line in my opinion: learn both, and decide which tasks you feel more comfortable doing in either language. There is no right or wrong answer.

If you don't like Perl's way of handling OO (personally, I do like it), check out Moose (find it on CPAN). PHP "being used as a template engine" is *not* a good thing IMO; it actively encourages mixing code and presentation, which leads to maintenance pains.
David Precious
+8  A: 

It's already been said that Perl offers everything you need for web development -- and I find it handy for one-off utilities as well, so I like having it in my toolkit. What I would recommend is that whatever language you choose, you invest the time to become truly proficient. You can write great code, or crap, in any language out there; and you'll be more productive, and spend much less time "hacking" (in the sense of trying stuff to see if it works) if you take the time to really "get" the language. Find some code written by experienced perl programmers, study it, question what you don't understand, and repeat.

+5  A: 

I did a lot of my web coding with CGI::Application. check it or any other framework that was previously mentioned, and you're set.

+3  A: 

Here is a nice article about the BBC's use of Perl including their custom MVC framework: BBC Article

+2  A: 

I have been using Perl for web applications an for website building for years now, PHP came later, and to be frank with you, Perl still has more to offer in terms of security, addons, speed and resources. Here is one example WebAPP open source Perl CMS scroll down and see the number of cached latest posts (over 200), try showing more then the latest 5-10 latest posts in joomla, wordpress or drupal.. and you will end up either by exhausting your server resources to death or having your webhost calling you..


+2  A: 

I used Catalyst in my internship experience, and I think that it has nothing to envy to the current web frameworks out there. The Catalyst community looks quite fertile and about the object orientation, I think that there's a Moose switch on a branch of the Catalyst development.

Catalyst is now written with Moose.
Brad Gilbert

Yes. Perl is being used for modern web development in many well known websites and it has all the features and tools needed. You need to consider who else is going to work with your code though. Perl is not so easy to master and it's flexibility in terms of how you do things demands fairly disciplined developers compared to other languages.

Angel Chiang
+2  A: 

I do love perl,really. But please mind this: Deployability. Only few of shared hosting out there that allow you to install catalyst(and its deps's),perl modules.
If you have the option (whatever that is) to implement full-blown perl web stack, go on.It's viable, no doubt.Otherwise, maybe you could use php because of its ubiquitous presence virtually in all unix/linux hosting , more of canned php script/app/cms/ offered in web-hosting compare to perl, and the possibly quicker setup than perl.

Excellent answer. Perl has always had this problem and PHP never did (my guess is mod_perl was just too hard to install). (Generally the voting on the answers here doesn't appear to reflect the quality of the answers, and this one is rated too low.)
+1  A: 

The combination DBIx::Class, Moose and Catalyst provides an ideal development framework for producing high-performance web applications. Not only is it fun but it works great as well!


I made a huge Web-application with Apache::ASP. Strange, that not many people use it. It allows you to write embedded code not in PHP but in pure perl. Extraordinary comfortable!