in reply to Re: RFC: How to succeed with your Perl homework
in thread RFC: How to succeed with your Perl homework

I personally would never ever advice a novice perl programmer to use common::sense, Modern::Perl or whatever module that replaces use strict; use warnings; and use autodie; for several reasons. The main reasons are:

In fact, it is way more likely that I will remove such declarations in scripts that I receive from others if I have to use it, than that it is likely that I will change my headers to move to whatever replacement for the default tantra is currently seen as best.

Remember that this is a guide for a homework-beginner. Not for a seasoned programmer that knows exactly why (not) to use common::sense.

I think I am a seasoned perl prgrammer, and I use git, elvis (a vi clone), strict, warnings, and more and more autodie.


Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
Re^3: RFC: How to succeed with your Perl homework
by chromatic (Archbishop) on Nov 03, 2010 at 20:35 UTC
    Remember that this is a guide for a homework-beginner.

    That's exactly why the second page of the Modern Perl book shows how to use Modern::Perl and explains what it does. It's awfully silly to poke fun at all of the boilerplate Java programmers have to convince their enterprise strength IDEs to emit for them before they can write "Hello, world!" when any correct Perl 5 program worth writing in 2010 has several lines of equally opaque boilerplate.

      I'm with Tux. First of all, one doesn't need any boilerplate to write "Hello world" in Perl.

      Second, there isn't much difference in effort to write the three line boiler plate:

      #!/usr/bin/perl use strict; use warnings;
      instead of two lines:
      #!/usr/bin/perl use Modern::Perl; # Or whatever todays fad boilerplate is
      The savings of not typing a single line of code doesn't out weight the issues Tux mentions.

      Now one may argue "but my 'use Shiny::Boilerplate;' includes a whole shit load of additional modules", but that only makes your boilerplate less generic. Because for each additional module/pragma in your boilerplate, a significant (probably > 50%) part of my programs/modules doesn't need it.

        Second, there isn't much difference in effort to write the three line boiler plate:

        It's not effort to write; it's effort to explain and to understand.

        If you want to write your own book where you tell novices "Include these three to seven magic lines at the start of every program you write, but don't worry if you don't understand them, they're really important, trust me, and yes I meant every program you write!" be my guest. My goal was teaching Perl novices to write code somewhat better than they could with Perl 4 (and not to clutter every piece of code where I happened to use say or given/when or state with use 5.010; or use 5.012;).

      That's exactly why the second page of the Modern Perl book shows ...

      What book? There is no book mentioned in the root