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

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.

  • Comment on Re^3: RFC: How to succeed with your Perl homework

Replies are listed 'Best First'.
Re^4: RFC: How to succeed with your Perl homework
by JavaFan (Canon) on Nov 04, 2010 at 15:44 UTC
    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;).

        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!"
        You must misunderstand me.

        If I say my boilerplate is:

        #!/usr/bin/perl use strict; use warnings;
        I don't intend to write that as:
        #!/usr/bin/perl use strict ; use warnings ;
        Three lines is just 3 lines. Not 7.

        As for explaining, I rather explain the benefits of "use strict" and "use warnings" then "oh, just download this magical thingy from the internet, written by some dude, who will tell you just to trust him and use the magical thingy everywhere".

        In my years as a trainer, I never explained things away with "oh, this is just a magical thing which I won't explain, just trust me, use it". I'm not that lousy.

Re^4: RFC: How to succeed with your Perl homework
by Anonymous Monk on Nov 04, 2010 at 20:15 UTC
    That's exactly why the second page of the Modern Perl book shows ...

    What book? There is no book mentioned in the root