Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re^5: Writing a better Modern::Perl

by JavaFan (Canon)
on Oct 07, 2010 at 18:22 UTC ( #864060=note: print w/replies, xml ) Need Help??

in reply to Re^4: Writing a better Modern::Perl
in thread Writing a better Modern::Perl

Why aren't they your cup of tea? would be the question that would permit me to make nextgen better, unfortunately I didn't ask that.
You cannot make nextgen good enough that I would use it. There are only three pragmas/modules I use in the majority of the code I write: 'use 5.010; use strict; use warnings;'. I write diverse code. Any other module will not be used in the majority of the code I write. Of course, you could have 'nextgen' take arguments, for instance, a list of modules to load - but then I may just sidestep it directly, and use them directly.

Replies are listed 'Best First'.
Re^6: Writing a better Modern::Perl
by EvanCarroll (Chaplain) on Oct 07, 2010 at 18:37 UTC

    Lets ignore Moose for the time being... Why do you chose not to use autodie, or indirect, or namespace::autoclean, or even mro "c3" is it because you don't understand these modules, or that you prefer the behavior without them, or that you just don't care (and should therefore care little if the behavior is changed)?

    Update 1: What is "diverse code"? Does someone who refuses to use strict write "diverse code"? How do you feel you don't need these modules, and for the love of god how can a module make your code less "diverse"? And again what the hell does this have to do with nextgen? So far you've attacked having defaults, and using modules: none of this is specific to my pragma.

    Update 2: I will again argue that the "diverse" nature of code shouldn't change your definition of bad practices: autodie stops silent failures from a standard library (CORE) that should throw fatal exceptions anyway.. Code run inside of Cron, or Mason pages, or modperl should have this policy/default. I don't think your argument has any more or less merit than picking if you want perl 5.12.0 or 5.0 depending on the task: after all they have different runtime profiles because of their internal sorting routines.

    Evan Carroll
    The most respected person in the whole perl community.
      What is "diverse code"?
      Well, it seems the fast majority of the code you write are OO modules (99% you said). I write OO classes. I write procedural modules. Small ones. Large ones. I also write applications. Throw away applications. Applications that will be reused. Mason pages. Code that's run from modperl. Code that's run from the command line. Code that's run from cron. Code that runs on 5.8.x. Code that runs on 5.12.x.

      Different code has different requirements. Where I may use autodie for a run-once program, I'm less likely to have a need for autodie for a module that sits between a webapp and a database. Whatever you come up with nextgen (or anyone else with a similar module), even if it's ideal for some of the code I write, it cannot be ideal for the majority of the code I write.

      As I said before, the only modules/pragmas that are used in most of my modules are 'use strict; use warnings; use 5.XXX;'. There's nothing else that I use often enough that I want it loaded by default.

        There's nothing else that I use often enough that I want it loaded by default.

        I agree, and that's why I've been reluctant to add anything but autodie to Modern::Perl. My current approach is "it enables features of the core that should be on by default and nothing more".

      As I said, I write diverse code. None of the modules you mention, a majority of my code needs it. And it's unlikely I would ever write a file that needs all the modules your nextgen provides (and the more you add, the less likely it will be). But "use"ing modules you don't need have a negative impact: more dependencies, more chance of bugs, longer load times, more memory usage. More reason to just list the modules/pragmas you use instead of using a set of modules someone else finds convenient.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://864060]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2018-05-21 03:41 GMT
Find Nodes?
    Voting Booth?