ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/common-sense/sense.pm
(Generate patch)

Comparing common-sense/sense.pm (file contents):
Revision 1.18 by root, Tue Sep 22 01:27:53 2009 UTC vs.
Revision 1.19 by root, Mon Oct 5 15:02:32 2009 UTC

4 4
5=head1 SYNOPSIS 5=head1 SYNOPSIS
6 6
7 use common::sense; 7 use common::sense;
8 8
9 # roughly the same as, with much lower memory usage: 9 # supposed to be the same, with much lower memory usage, as:
10 # 10 #
11 # use strict qw(vars subs); 11 # use strict qw(vars subs);
12 # use feature qw(say state switch); 12 # use feature qw(say state switch);
13 # no warnings; 13 # no warnings;
14 # use warnings qw(FATAL closed threads internal debugging pack substr malloc 14 # use warnings qw(FATAL closed threads internal debugging pack substr malloc
139 139
140=cut 140=cut
141 141
142package common::sense; 142package common::sense;
143 143
144our $VERSION = '2.0'; 144our $VERSION = '2.01';
145 145
146# paste this into pelr to find bitmask 146# paste this into perl to find bitmask
147 147
148# no warnings; 148# no warnings;
149# use warnings qw(FATAL closed threads internal debugging pack substr malloc unopened portable prototype 149# use warnings qw(FATAL closed threads internal debugging pack substr malloc unopened portable prototype
150# inplace io pipe unpack regexp deprecated exiting glob digit printf 150# inplace io pipe unpack regexp deprecated exiting glob digit printf
151# utf8 layer reserved parenthesis taint closure semicolon); 151# utf8 layer reserved parenthesis taint closure semicolon);
154 154
155# overload should be included 155# overload should be included
156 156
157sub import { 157sub import {
158 # verified with perl 5.8.0, 5.10.0 158 # verified with perl 5.8.0, 5.10.0
159 ${^WARNING_BITS} = "\xfc\x3f\xf3\x00\x0f\xf3\xcf\xc0\xf3\xfc\x33\x03"; 159 ${^WARNING_BITS} ^= ${^WARNING_BITS} ^ "\xfc\x3f\xf3\x00\x0f\xf3\xcf\xc0\xf3\xfc\x33\x03";
160 160
161 # use strict vars subs 161 # use strict vars subs
162 $^H |= 0x00000600; 162 $^H |= 0x00000600;
163 163
164 # use feature 164 # use feature
251 251
252apeiron (meta-comment about us commenting^Wquoting his comment) 252apeiron (meta-comment about us commenting^Wquoting his comment)
253 253
254 How about quoting this: get a clue, you fucktarded amoeba. 254 How about quoting this: get a clue, you fucktarded amoeba.
255 255
256=head1 FREQUQNTLY ASKED QUESTIONS
257
258Or frequently-come-up confusions.
259
260=over 4
261
262=item Is this module meant to be serious?
263
264Yes, we would have put it under the C<Acme::> namespace otherwise.
265
266=item But the manpage is written in a funny/stupid/... way?
267
268This was meant to make it clear that our common sense is a subjective
269thing and other people can use their own notions, taking the steam out
270of anybody who might be offended (as some people are always offended no
271matter what you do).
272
273This was a failure.
274
275But we hope the manpage still is somewhat entertaining even though it
276explains boring rationale.
277
278=item Why do you impose your conventions on my code?
279
280For some reason people keep thinking that C<common::sense> imposes
281process-wide limits, even though the SYNOPSIS makes it clear that it works
282like other similar modules - only on the scope that uses them.
283
284So, no, we don't - nobody is forced to use this module, and using a module
285that relies on common::sense does not impose anything on you.
286
287=item Why do you think only your notion of common::sense is valid?
288
289Well, we don't, and have clearly written this in the documentation to
290every single release. We were just faster than anybody else w.r.t. to
291grabbing the namespace.
292
293=item But everybody knows that you have to use strict and use warnings,
294why do you disable them?
295
296Well, we don't do this either - we selectively disagree with the
297usefulness of some warnings over others. This module is aimed at
298experienced Perl programmers, not people migrating from other languages
299who might be surprised about stuff such as C<undef>.
300
301In fact, this module is considerably I<more> strict than the canonical
302C<use strict; use warnings>, as it makes all warnings fatal in nature, so
303you can get away with as many things as with the canonical approach.
304
305This was not implemented in version 1.0 because of the daunting number
306of warning categories and the difficulty in getting exactly the set of
307warnings you wish (i.e. look at the SYNOPSIS in how complicated it is to
308get a specific set of warnings - it is not reasonable to put this into
309every module, the maintainance effort would be enourmous).
310
311=item But many modules C<use strict> or C<use warnings>, so the memory
312savings do not apply?
313
314I am suddenly so sad.
315
316But yes, that's true. Fortunately C<common::sense> still uses only a
317miniscule amount of RAM.
318
319=item But it adds another dependency to your modules!
320
321It's a fact, yeah. But it's trivial to install, most popular modules have
322many more dependencies and we consider dependencies a good thing - it
323leads to better APIs, more thought about interworking of modules and so
324on.
325
326=item But! But!
327
328Yeah, we know.
329
330=back
331
256=head1 AUTHOR 332=head1 AUTHOR
257 333
258 Marc Lehmann <schmorp@schmorp.de> 334 Marc Lehmann <schmorp@schmorp.de>
259 http://home.schmorp.de/ 335 http://home.schmorp.de/
260 336

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines