… | |
… | |
231 | favourable way, calling it outright "wrong"), but standard utilities, such |
231 | favourable way, calling it outright "wrong"), but standard utilities, such |
232 | as L<prove>, or MakeMaker when running C<make test>, still enable them |
232 | as L<prove>, or MakeMaker when running C<make test>, still enable them |
233 | blindly. |
233 | blindly. |
234 | |
234 | |
235 | For version 2 of common::sense, we finally sat down a few hours and went |
235 | For version 2 of common::sense, we finally sat down a few hours and went |
236 | through I<every single warning message>, identifiying - according to |
236 | through I<every single warning message>, identifying - according to |
237 | common sense - all the useful ones. |
237 | common sense - all the useful ones. |
238 | |
238 | |
239 | This resulted in the rather impressive list in the SYNOPSIS. When we |
239 | This resulted in the rather impressive list in the SYNOPSIS. When we |
240 | weren't sure, we didn't include the warning, so the list might grow in |
240 | weren't sure, we didn't include the warning, so the list might grow in |
241 | the future (we might have made a mistake, too, so the list might shrink |
241 | the future (we might have made a mistake, too, so the list might shrink |
… | |
… | |
250 | warnings>, which is good if you are into strict things (we are not, |
250 | warnings>, which is good if you are into strict things (we are not, |
251 | actually, but these things tend to be subjective). |
251 | actually, but these things tend to be subjective). |
252 | |
252 | |
253 | After deciding on the list, we ran the module against all of our code that |
253 | After deciding on the list, we ran the module against all of our code that |
254 | uses C<common::sense> (that is almost all of our code), and found only one |
254 | uses C<common::sense> (that is almost all of our code), and found only one |
255 | occurence where one of them caused a problem: one of elmex's (unreleased) |
255 | occurrence where one of them caused a problem: one of elmex's (unreleased) |
256 | modules contained: |
256 | modules contained: |
257 | |
257 | |
258 | $fmt =~ s/([^\s\[]*)\[( [^\]]* )\]/\x0$1\x1$2\x0/xgo; |
258 | $fmt =~ s/([^\s\[]*)\[( [^\]]* )\]/\x0$1\x1$2\x0/xgo; |
259 | |
259 | |
260 | We quickly agreed that indeed the code should be changed, even though it |
260 | We quickly agreed that indeed the code should be changed, even though it |
… | |
… | |
262 | |
262 | |
263 | |
263 | |
264 | =item much reduced typing |
264 | =item much reduced typing |
265 | |
265 | |
266 | Especially with version 2.0 of common::sense, the amount of boilerplate |
266 | Especially with version 2.0 of common::sense, the amount of boilerplate |
267 | code you need to add to gte I<this> policy is daunting. Nobody would write |
267 | code you need to add to get I<this> policy is daunting. Nobody would write |
268 | this out in throwaway scripts, commandline hacks or in quick internal-use |
268 | this out in throwaway scripts, commandline hacks or in quick internal-use |
269 | scripts. |
269 | scripts. |
270 | |
270 | |
271 | By using common::sense you get a defined set of policies (ours, but maybe |
271 | By using common::sense you get a defined set of policies (ours, but maybe |
272 | yours, too, if you accept them), and they are easy to apply to your |
272 | yours, too, if you accept them), and they are easy to apply to your |
… | |
… | |
289 | |
289 | |
290 | The money/time/effort/electricity invested in these gigabytes (probably |
290 | The money/time/effort/electricity invested in these gigabytes (probably |
291 | petabytes globally!) of wasted memory could easily save 42 trees, and a |
291 | petabytes globally!) of wasted memory could easily save 42 trees, and a |
292 | kitten! |
292 | kitten! |
293 | |
293 | |
294 | Unfortunately, until everybods applies more common sense, there will still |
294 | Unfortunately, until everybody applies more common sense, there will still |
295 | often be modules that pull in the monster pragmas. But one can hope... |
295 | often be modules that pull in the monster pragmas. But one can hope... |
296 | |
296 | |
297 | =cut |
297 | =cut |
298 | |
298 | |
299 | package common::sense; |
299 | package common::sense; |
… | |
… | |
478 | |
478 | |
479 | This was not implemented in version 1.0 because of the daunting number |
479 | This was not implemented in version 1.0 because of the daunting number |
480 | of warning categories and the difficulty in getting exactly the set of |
480 | of warning categories and the difficulty in getting exactly the set of |
481 | warnings you wish (i.e. look at the SYNOPSIS in how complicated it is to |
481 | warnings you wish (i.e. look at the SYNOPSIS in how complicated it is to |
482 | get a specific set of warnings - it is not reasonable to put this into |
482 | get a specific set of warnings - it is not reasonable to put this into |
483 | every module, the maintenance effort would be enourmous). |
483 | every module, the maintenance effort would be enormous). |
484 | |
484 | |
485 | =item But many modules C<use strict> or C<use warnings>, so the memory |
485 | =item But many modules C<use strict> or C<use warnings>, so the memory |
486 | savings do not apply? |
486 | savings do not apply? |
487 | |
487 | |
488 | I suddenly feel sad... |
488 | I suddenly feel sad... |