scheaz99 has asked for the wisdom of the Perl Monks concerning the following question:

Hello there.. I am a student.. started learning perl and read books (learning perl and mastering perl). please tell me, as today(2014), why one should prefer perl to create a web app? And, I want to know how can I use perl to create web app. (i am new to web application too) where i can start from the beginning for applications..? please answer in steps. I'm really confused. Thanks in advance!

Replies are listed 'Best First'.
Re: using perl as a new user
by Your Mother (Archbishop) on Sep 12, 2014 at 21:46 UTC

    There is no convincing argument that can be made to a beginner because you couldn’t understand or appreciate the authenticity or fallibility of claims about Perl over other languages. You said “applications.” If you’re talking about phones, the following advice is semi-meaningless. I’m writing about general, back-end-centric web development.

    So, over-generalization!

    PHP is fine. It’s easy. There are tons of examples and help available. It’s also got more pitfalls and problems than just about anything and the community standards are so low as to border on the criminal when it comes to security and such… though the same could be said about Perl 15 years ago.

    Python is fine. It’s on a very similar playing field with Perl but it’s more restrictive by tradition and format. Perl’s élan of TIMTOWTDI is not considered a strength to a Python hacker but a vile, unnecessary degree of freedom, an abomination that has fallen short of the glory of God.

    Java is pushed by a corporate agenda to do what ostensibly sounds good: normalize development in a safe, clear, controlled way. For me it ends up an exercise in hoop jumping with a level of verbosity that achieves the exact opposite of clarity. Over explanation is worse than no explanation, even for a sharp layman. For an expert in a field, it borders on torture.

    Ruby. The amount of thunder that comes from Ruby compared to the amount of hackers using it and the things done with it is really quite strange… I understand a lot of devs, including a lot of Perl (and former Perl) devs love it. I think it’s no better than Perl in general and fails to keep up with Perl in speed, Unicode, libraries…

    Scala. Seems a lot like Perl to me, what little I’ve seen. There is little to see so far.

    JavaScript… no longer painful to use server-side, it’s pretty cool and it’s more likely to inherit the immediate future of the web (HTML5 and friends, Flash will hardly be used in 10 years and a footnote in 15, so I say) than anything already covered. Also, if you’re going to be a web dev of any caliber, you’ll have to know some for the front-end anyway. If I were starting from scratch, I might stay right here.

    Perl. Easy to start. Years of good documentation in print and online. Style chameleon: procedural, functional, OO; whatever mix you like. Lowest defect density (fewest bugs per feature) of all the high level languages. Extremely fast for an interpreted language and not usually used that way in web production anyway so it can be even faster. Rich history of promoting new code, even of marginal quality, to increase the ecosphere. Tolerant of new and competing approaches. Best testing culture, probably. Tons of friendly users willing to help you at every level. Its flexibility means you can code the way you think. This is seen as a weakness sometimes as we don’t all think through problems super clearly on the first take… but it’s certainly inviting and ship early, ship often beats analysis paralysis pretty much every time.

    Perl also has about 20 ways to produce web apps now which are, thanks to the PSGI standard, easy to couple or mix or migrate, and most importantly test!

    Pick a tiny project. Try it in Perl and another language or two. See how you like the pace, resources, help, results. I would not be in this line of work if not for Perl so I’m pretty biased but that’s a good referral itself. :P

Re: using perl as a new user
by ww (Archbishop) on Sep 12, 2014 at 22:40 UTC

    I can give you only one view -- that of an individual who uses Perl for many tasks: system admin (*nix and Win); inventory management s/w, local (specialized) search engines, online catalogue and ordering systems... the last three for clients who came to me originally to have me build'em websites. So numerous prejudices will show.

    To answer your initial inquiry "why one should prefer Perl...?" -- Because it will do the job, with minimum pain and stain; allow you to create rigorously tested programs; offer literally thousands of non-core modules for special purposes; and situate you, as YM noted above, in a community where mutual aid is a part of the culture.

    But let me not omit a fact relevant to programming in any language: you gotta' learn it. There is no substitute unless you wish to do no more than cargo-cult code (often questionable) from 'some site on the internet.' Your choice of books -- esp. "Learning Perl" is good for someone new to the language AND to programming (you don't say whether you've programmed in any other language, before).

    And here's another first things first :-). If you really mean an "ap" in the sense that originated with smart phones, tablets, etc. you'll find some threads here (hint: Super Search) that may be illuminating but you should probably consider other languages such as :-( java for instance, I acknowledge with regret) but if you mean an "ap" in the sense of a dynamic web function (ordering, searching, etc), then CGI and PSGI will be at the roots of what you need to know. The Tutorials section here includes excellent resources for learning Perl/CGI.

    If you're really most interested in "web" projects, you're likely to need to know how servers (APACHE etc) work; have a pretty good notion of the protocols that underlie the web; have a thorough grounding with HTML (4 and 5) and CSS (at least thru 2). Most of those are topics you can absorb to a functional level in a very short time -- perhaps as little as a week or a month or two (since html is so 'English-like' and CSS originated as an alterative to some html tags the deal with appearances). But beware some 'tutorials' which espouse merely-faddish separation of 'substance' and 'presentation' and most of the hoohah advocating the 'semantic web.'

    The list ("in steps") for which you ask and which go beyond the points above are not readily served up on a platter because we don't know to what extent you've mastered the skills you're going to need nor the precise goals you have in mind (for example, see preceding para). But in most cases, I suspect the next step is to start with small challenges -- write a script to find all the mp3s on you system or a script to consolidate .jpgs in a single directory or a script to say 'hello world' -- first in a terminal (command prompt window) and then in a browser....

    At which point, you may be back with more particular questions. We hope so. PM exists to help you learn when you get stuck on a problem you've tackled.


    Don't just copy this into a homework assignment if that's the genesis of your questions.


Re: using perl as a new user
by davido (Cardinal) on Sep 12, 2014 at 22:53 UTC

    After "Learning Perl", "Intermediate Perl" is the best next step, along with the free online book "Modern Perl".

    If you're looking for how easy and fun it can be to develop a web application and haven't stopped by the Mojolicious website yet, you'll be in for a surprise.


    Dave

Re: using perl as a new user
by Laurent_R (Canon) on Sep 12, 2014 at 22:26 UTC
    Hmm, Perl, PHP, Ruby, probably Scala (which I don't really know) and even Java (despite many things) are probably fine for developing web applications. (Plus of course Javascript, but it is a slightly different kind of animal.)

    Perl was definitely the best tool 15 years ago, today, this is debatable. The real question might be not so much the language itself, but the frameworks available in those languages. Perl has a number of such frameworks (Catalyst, Mojolicious, Dancer, Plack, not to speak about basic CGI), other languages also have similar frameworks. Look at these frameworks (Perl or other), and try to figure out what is your best bet.

    I would personally go for Perl, because I know the language, but not everyone has to think the same way.

Re: using perl as a new user
by einhverfr (Friar) on Sep 13, 2014 at 12:02 UTC

    I can't recommend books without knowing more about your background as a developer. What other computing languages do you know? If you know Lisp or Scala, I will recommend very different books than if you know C or Java.

    As to why I prefer Perl for creating web apps, that I can answer: Perl is a very unopinionated, multi-paradigm programming language. You can move seamlessly between paradigms and while that can be dangerous, it can also be extremely powerful. It is also an extremely flexible programming language.

    I remember when I was starting with Perl and thought it felt like a slightly obtuse cousin to PHP. I also remember all the times feeling like "a language shouldn't shove its internals in your face." However over time I have come to really appreciate the power that what I previously considered to be misfeatures give you. For this reason I think the idea that Perl is like an onion is quite apt. It really is a deeply layered language and one you can take extremely far. It's that depth and power which make it my favorite language today.

    So rather than recommend books, I am going to recommend a few things in addition:

    1. Learn Lisp if you haven't already. You will be a far more effective Perl programmer and better understand the language if you have at least a basic grasp of Lisp.
    2. Spend some time with Moo and Moose. These are object systems which really get a whole lot right (unlike most object oriented languages out there).
Re: using perl as a new user
by Discipulus (Canon) on Sep 15, 2014 at 09:38 UTC
    hello and welcome scheaz99

    First i have to say that Perl is my only programming language and also that i had no programming nor scientific background before starting.
    So i can tell that after more than 14 years i'm very happy with Perl a tool that open as many doors you want: I dunno if other monks with a vaste programming background, can tell of another language used for so many different things. On my experience i can say i used Perl with success to: administration and automation of windows systems (and some Linux too for my sanity..), heavy work on text and data (the original goal of the language), full power regular expressions, graphical programming with Tk, fast and secure interaction with databases via DBI, web client emulation via LWP, web programming via CGI (many years ago.. will discuss this topic later), big template support with Template Toolkit, full Unicode support, friendly community, biiiig module repository (on CPAN you' ll find that other peoples had your same problems and had resolved in (usually) a smart way so half or all the work is already done..) and dont forget the fun to lurk at perlmonks..

    As personal note i can add: you'll love Perl for the freedom given to you to do what you wont in the way you wont, for the errors it reports (very punctual and appropriate comments not 'ton of noise lines with no sense') and for the possibility to have the work done in few baunch of lines.

    So, if you choice learning Perl as big investment (come on jump on it!) here you'll find my personl advice about your steps, assuming you wont to go in the field of web serverside programming.

    • Be sure to understand how Internet works, at large, servers and client roles, the importance of DNS and how, roughly, how a browser request things to a server and compose the page.

    • As already said you have to know about HTML and Css.

    • finally some Perl stuff: a usefull book to have is always Perl Cookbook. It somehow aged but you get a big picture of what Perl can do for you. As you understand things compare with the content of Modern Perl to get an idiomatic usage of the language and to avoid pitfall.

    • Do not waste time with CGI: my be it is worth for some introduction and rudimentary example, but the future is another:

    • PSGI and Plack are the keyword of Perl rebirth in web developping field. The first is a specification and the second is 'Perl Superglue for Web frameworks and Web Servers (PSGI toolkit)'

    • You can then choose a web framework to build easely your web apps: Mojolicious, Dancer2 are valid choice as i heard, but there are many other. Now i use Dancer2 but i'm still practicing with new web stuff. The future seems promising!


    So tell us what you decided and i hope we'll see here at perlmonks.

    HtH
    L*
    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
      I love perl... it works beautifully and I had studied few other languages I really think perl is the smartest. Thanks