http://qs321.pair.com?node_id=920554

perl.j has asked for the wisdom of the Perl Monks concerning the following question:

Fellow Monks,

I have been wanting to create a website from scratch from before I started learning Perl. I wanted to have it fully customized, without using tools such as Wordpress, Webs, or Blogger. So my question to you is...

Is it possible to make an entire website, using only Perl and Perl Modules (and if needed, some HTML)?

Thanks in advance

--perl.j

Replies are listed 'Best First'.
Re: Creating a Website in Perl
by jethro (Monsignor) on Aug 16, 2011 at 20:13 UTC

    Well, you are looking at such a website, so yes.

    There are many modules that can help you with that. One of the oldest and simplest is CGI, but without giving up control you can also use frameworks like CGI::Application or Catalyst that try to seperate HTML code from the data (so that you can independently create the look-and-feel of the website and the contents). These frameworks often use the MVC-Pattern, a well established form of website design

    Part of this are modules that fill a html template (the look) with data to create the final web page, for example HTML::Template. Oh and don't forget modules to help with sign-on, cookies, forms,... you name it

    By the way, your question suggests that you didn't even use google or the super-search on this website to get some basic information. As a result you have to live with very general answers that might not get you very far.

Re: Creating a Website in Perl
by aaron_baugher (Curate) on Aug 16, 2011 at 20:12 UTC

    Short answer: yes, absolutely.

    Longer answer: you can build websites using any language that can write to standard output, and people were using Perl for websites long before languages like PHP even existed. The CGI.pm module simplified much of the process, but we still wrote a lot of HTML, either printing it from Perl or using templating systems.

    Nowadays many people use Perl frameworks like Catalyst or Dancer, which are module bundles that automate even more of the grunt work involved in getting the data (often from a database) and handling input/output to the server. Another option is an inline coding system like HTML::Mason, which lets you write HTML with Perl code inserted where needed (somewhat like PHP).

Re: Creating a Website in Perl
by Your Mother (Archbishop) on Aug 16, 2011 at 23:26 UTC

    I echo what aaron_baugher said: absolutely. But I have a different set of caveats.

    Reproducing the functionality of any straightforward blog platform is semi-trivial for an advanced hacker with web experience. Making it solid, deployable, generic, extensible, robust, secure, self-administrating, backup-data-safe, well-tested, et cetera, et cetera, is a bear and has so many different cogs and avenues that even that advanced hacker could easily sink a year into it and it would not cover the hundreds of plugins available to something like WordPress.

    I am entirely in favor of doing this kind of thing. Just realize what you’re doing. A newly minted hacker would sink that year just getting basic account, posts, comments, and deployment and it would be throwaway code. I oughta know. I’ve done it four times. The learning experience has been invaluable however and a huge degree of my employability came from taking these experiments seriously.

    If you start this, gravitating toward the dispatch/routing frameworks will be harder than just starting to write code *initially* but a hundred times easier after you start to get the feel of it. If you get this set of abbreviations down (not code as much as the specifications)—HTTP, CGI, HTML, CSS, JS, SQL, XSS, CSRF—then everything that follows will be drastically less mysterious.

      Thanks to everyone who gave answers!
      --perl.j
Re: Creating a Website in Perl
by blindluke (Hermit) on Aug 16, 2011 at 21:16 UTC

    Both previous replies already answer your question - it's very possible.

    I'd like to add, that I've created a few websites with the help of CGI::Application and HTML::Template, and I cannot recommend the duo enough. Read the excellent tutorials here, if you want a good start:

    Note, that HTML, as well as basic CSS knowledge, is usually needed, if you want the site to look at least decent. The good news is, that HTML::Template provides very little overhead - you can give the template file to a fellow web designer, and he'll be able to make something decent out of it. You can also use any free web template with HTML::Template with very little work.

    Good Luck!

    Luke Jefferson

Re: Creating a Website in Perl
by metaperl (Curate) on Aug 16, 2011 at 21:47 UTC
Re: Creating a Website in Perl
by Anonymous Monk on Aug 18, 2011 at 12:07 UTC

    Other monks have given some fine advice and I recommend that you listen to them. You may not be aware of the history of the web but, once upon a time, almost all dynamic web pages were written in Perl and we're still up to the job.

    The other thing I'd like to point out is that you can even write custom web servers in Perl but it's usually better to let apache/nginx/etc do the heavy lifting.

      Oh, and yes, HTML is pretty much mandatory if you want to spit out web pages. It's going to be hard if you don't understand the language you're trying to speak. I say "pretty much" because you could send XML+XSLT but you would still need to know HTML to write a reasonable XSL transformation for XML.

Re: Creating a Website in Perl
by zby (Vicar) on Aug 19, 2011 at 10:26 UTC
    Since you mentioned blog engines: Nblog is my experimental one. I plan to put it on CPAN soon.
Re: Creating a Website in Perl
by Anonymous Monk on Aug 16, 2011 at 22:14 UTC
    Just be sure, first, that you are not doing a thing already done.