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

Greetings monks,

For the first time, I am going to get chance to work on creating an entire webpage for a new application which will be built from scratch.

In past I had to use only available perl modules with pre installed perl (5.8 and then 5.10) as I work in restricted network. I couldn't even use CPAN to get any new modules due to restrictions.

So now as the project is in initial stage, I can suggest for a specific version of perl and can give a list of modules that might be required. And here I am looking for some suggestions from you, the wise monks!

Will perl 5.18 will be best option to go for? It'll be on a Linux box and the webpage I'll have to build will be a tab on the web based application. This application is being built using tableau (a reporting tool). There would be multiple databases from where we would have to fetch data and store in the applications database which will be MySQL. Other DBs from where we'll fetch data are SQL Server, MySQL, EDW and might be even more.

Talking about the webpage, I'll most probably have to build it using cgi. It'll have all different type of elements as checkboxes, tables, user editable fields etc. the page will be refreshed evey 5 minutes with real time data from different sources (DB from where we'll pull data). Tables will be updated with real time data. Any changes made by users manually using check boxes and user editable fields will result in changes on other tabs of the application. Like some elements from other tabs will appear/disappear. Changing user editable fields will result in change in logic for backend queries or data being displayed in tables on this or other pages.

Knowing this and considering my moderate level of understanding of perl (1 year, not extensive), can you please suggest me what modules (that are not included with perl installation) would be useful for me. Once perl and additional modules are installed then in future it might be difficult to get any new modules so I am trying to get as many as we can upfront.

Thank you in advance and please forgive me for such a lengthy post.

  • Comment on Need generic advise on how to use modern perl for building webpage and which modules should be installed.

Replies are listed 'Best First'.
Re: Need generic advice on how to use modern perl for building webpage and which modules should be installed.
by jeffa (Bishop) on Aug 12, 2015 at 21:31 UTC

    You can go full out with Catalyst and Class::DBI DBIx::Class (edit: i dislike both and avoid ORMs in general although i have found that Ruby's Active Record solution takes care of the duplicity problem) but i would look at either Dancer or Mojolicious::Lite to create your framework. You most likely will want to incorporate some AJAX calls and such frameworks help to keep your code clean. I also recommend using Template::Toolkit as your templating engine but as long as you are using a templating engine then you should be better off than not. There are plenty of CPAN modules that allow you to communicate with database servers et. al. And last but not least, use Twitter Bootstrap to handle dynamic JS and CSS styling and help with AJAX and JQuery calls.

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    

      Mojolicious has its own templating language -ep- which is basically Perl itself.

      I was also a big fan of Template Toolkit, and still use it on occasion. Yet I hardly ever use it for web templating anymore, because ep is so flexible. It is also nice to have one less dependency in the mix.

      I highly recommend that you spec out the app as suggested, but would encourage you to favor building interfaces as collections of dynamically generated 'widgets' rather than monolithic pages. Having to work on a few such monstrosities I can tell you that the pain of 'just one change' becomes:

      1. change the template
      2. fiddle with the javascript
      3. muck about with your objects/backend code
      4. resist the urge of self-defenestration

      I won't even mention how bad it becomes when there are database changes as well.

      Think of parts of your page as widgets (or boxes, cartons lol) whatever. Decompose the interface into many pieces that can be generated independently. Then the 'just one change' might actually be small enough to just require one of the steps above, and probably not the last one.

Re: Need generic advise on how to use modern perl for building webpage and which modules should be installed.
by nevdka (Pilgrim) on Aug 13, 2015 at 00:07 UTC

    I was in a similar position to you at the start of this year. 18 months of perl experience in 5.8/5.10 in a restricted environment, then building a 'modern' website where I had full control over everything on the server.

    I chose to use Mojolicious for web stuff, and Moose for all my objects. The tutorials and documentation for both of them were brilliant, and I didn't have any major difficulties.

Re: Need generic advise on how to use modern perl for building webpage and which modules should be installed.
by Perl300 (Friar) on Aug 13, 2015 at 03:33 UTC

    Thank you jeffa, nevdka and sundialsvc4 for your guidance.

    nevdka, it's nice to know about your experience as it's almost same situation what I'll go through. Your experience will definitely help me to make proper selections.

    sundialsvc4, your detailed guidelines are really important and I'll try to keep those in mind at every specific stage.

      jeffa is an excellent Perl hacker with good advice but do not use Class::DBI (CDBI in dialect); which would be a fine choice if there weren't alternatives but there have been for a decade. If you want an ORM style DB interface/model there are a few preferable including and especially DBIx::Class (DBIC in dialect). It's much faster, better designed, more extensible, and doesn't turn to spaghetti on edge cases.

      sundialsvc4 has barely been able to compose two or three nodes of valid Perl in all his years and 4,000+ posts here. And his advice all but told you that could do your project without writing any code. If you take that kind of guidance at face value, you're going to have a bad time with Perl and in life for that matter. No links, no code, no concrete action to take > /dev/null 2>&1. Please also see Worst Nodes; as of this moment he occupies 4/5 Today, 9/10 Week, 9/10 Month, 10/20 Year.

A reply falls below the community's threshold of quality. You may see it by logging in.
A reply falls below the community's threshold of quality. You may see it by logging in.