Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: Should Test::Most import strict and warnings?

by stvn (Monsignor)
on Feb 06, 2010 at 17:05 UTC ( [id://821761]=note: print w/replies, xml ) Need Help??


in reply to Re: Should Test::Most import strict and warnings?
in thread Should Test::Most import strict and warnings?

I'm not a fan of these micro-packages that try to save boilerplate ...
These modules which enable strict for the caller reduce the number of modules which appear to use strict ...

I couldn't agree more about the micro-package thing, I think this does add a layer of confusion to those new to the perl community. Especially since it seems to have brought out the bad side of TIMTOWTDI, with all the different variations. For instance, Modern::Perl is 5.10 (or above) only, imports warnings and strict and sets the MRO to use c3. While common::sense imports only some strictures (vars & subs), a select few 5.10 features, a handful of warnings AND makes all warnings FATAL (this, for those who don't know, escalates all warnings to fatal errors). These two modules seem to have similar goals, but end up changing your environment in sometimes radical and sometimes subtle ways.

However, I do not agree when talking about non-micro-packages like Test::Most.

I can (just) swallow it for Moose (which could probably be a pragma itself anyway), but don't like it in general.

Well, I think you can likely swallow it easier because all Moose does is to turn on strict and warnings. Basically reproducing the effect of the "use strict; use warnings;" boilerplate that most people have been using (and the community at large has been advocating) for at least the past 7 or 8 years now. You can still turn any strictures or warnings off lexically if you want too, but for the most part, Moose just sets up the environment that the majority of people have been using for a long time now. And basically, that is what Ovid is proposing Test::Most do as well.

Also, I am curious as to why you think Moose should be a pragma? Pragmas typically just twiddle with the guts of Perl some and then let you go about your business. Moose turns the guts of Perl inside-out, twists them around all meta-circular-like, sprinkles on some sugar and then sticks around to make sure you don't cut off a limb or two.

-stvn

Replies are listed 'Best First'.
Re^3: Should Test::Most import strict and warnings?
by duelafn (Parson) on Feb 08, 2010 at 18:02 UTC
    non-micro-packages like Test::Most.

    Test::Most is a bit confused in that it provides both real functionality as well as the "micro-package" features. If Test::Most were split (only hypothetically, I'm not so much suggesting that it do so) into Test::Most::Features and Test::Most::ImportOtherPackages (where the strictures enforcing would be placed), then my beef is with Test::Most::ImportOtherPackages, and not with Test::Most::Features.

    I am curious as to why you think Moose should be a pragma?

    pragma (meaning just "all lower-case name") modules advertise "something more than simple function importing is happening here". Aside from enabling strict, I believe, Moose accomplishes everything it does via simple sub imports (no overwriting of core functions, ...) so strictly speaking it should not be a pragma. However, it does feel a lot more magical than a plain module, and it imports subs which further create/import more subs which feels like it is extending the syntax of perl... Thus, I would accept arguments that it could have been named all-lower. Though I am not necessarily arguing that it should have.

    Good Day,
        Dean

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://821761]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2024-04-23 19:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found