Hello community, here is the log from the commit of package perl-strictures for openSUSE:Factory checked in at 2013-06-06 13:27:51 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-strictures (Old) and /work/SRC/openSUSE:Factory/.perl-strictures.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-strictures" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-strictures/perl-strictures.changes 2012-05-25 16:17:56.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.perl-strictures.new/perl-strictures.changes 2013-06-06 13:27:52.000000000 +0200 @@ -1,0 +2,11 @@ +Tue Jun 4 11:51:58 UTC 2013 - co...@suse.com + +- updated to 1.004004 + - fix 5.16 crash due to qw() list being readonly + - check only once for presence of extra testing prereqs + - explicitly specify no dynamic_config in META + - add better rationale for the extra testing heuristic + - test-specific strictures now enabled during 'dzil test' + - switch to testing calling file to avoid firing on dependencies + +------------------------------------------------------------------- Old: ---- strictures-1.003001.tar.gz New: ---- strictures-1.004004.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-strictures.spec ++++++ --- /var/tmp/diff_new_pack.zqdPau/_old 2013-06-06 13:27:52.000000000 +0200 +++ /var/tmp/diff_new_pack.zqdPau/_new 2013-06-06 13:27:52.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package perl-strictures # -# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,14 +17,14 @@ Name: perl-strictures -Version: 1.003001 +Version: 1.004004 Release: 0 %define cpan_name strictures Summary: turn on strict and make all warnings fatal License: Artistic-1.0 or GPL-1.0+ Group: Development/Libraries/Perl Url: http://search.cpan.org/dist/strictures/ -Source: http://www.cpan.org/authors/id/M/MS/MSTROUT/%{cpan_name}-%{version}.tar.gz +Source: http://www.cpan.org/authors/id/E/ET/ETHER/%{cpan_name}-%{version}.tar.gz BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl @@ -36,6 +36,9 @@ #BuildRequires: perl(strictures) >= 1 #BuildRequires: perl(Test::Pod) #BuildRequires: perl(Test::Pod::Coverage) +Recommends: perl(bareword::filehandles) +Recommends: perl(indirect) +Recommends: perl(multidimensional) %{perl_requires} %description @@ -43,13 +46,13 @@ about a year now. I figured it was time to make it shorter. Things like the importer in 'use Moose' don't help me because they turn -warnings on but don't make them fatal - which from my point of view is -useless because I want an exception to tell me my code isn't warnings -clean. +warnings on but don't make them fatal -- which from my point of view is +useless because I want an exception to tell me my code isn't +warnings-clean. Any time I see a warning from my code, that indicates a mistake. -Any time my code encounters a mistake, I want a crash - not spew to STDERR +Any time my code encounters a mistake, I want a crash -- not spew to STDERR and then unknown (and probably undesired) subsequent behaviour. I also want to ensure that obvious coding mistakes, like indirect object @@ -57,20 +60,20 @@ compile as such) get caught, but not at the cost of an XS dependency and not at the cost of blowing things up on another machine. -Therefore, strictures turns on additional checking, but only when it thinks -it's running in a test file in a VCS checkout - though if this causes -undesired behaviour this can be overridden by setting the -PERL_STRICTURES_EXTRA environment variable. +Therefore, the strictures manpage turns on additional checking, but only +when it thinks it's running in a test file in a VCS checkout -- although if +this causes undesired behaviour this can be overridden by setting the +'PERL_STRICTURES_EXTRA' environment variable. If additional useful author side checks come to mind, I'll add them to the -_EXTRA code path only - this will result in a minor version increase (i.e. -1.000000 to 1.001000 (1.1.0) or similar). Any fixes only to the mechanism -of this code will result in a subversion increas (i.e. 1.000000 to 1.000001 -(1.0.1)). +'PERL_STRICTURES_EXTRA' code path only -- this will result in a minor +version increase (e.g. 1.000000 to 1.001000 (1.1.0) or similar). Any fixes +only to the mechanism of this code will result in a sub-version increase +(e.g. 1.000000 to 1.000001 (1.0.1)). If the behaviour of 'use strictures' in normal mode changes in any way, -that will constitute a major version increase - and the code already checks -when its version is tested to ensure that +that will constitute a major version increase -- and the code already +checks when its version is tested to ensure that use strictures 1; ++++++ strictures-1.003001.tar.gz -> strictures-1.004004.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/strictures-1.003001/Changes new/strictures-1.004004/Changes --- old/strictures-1.003001/Changes 2012-04-08 21:06:52.000000000 +0200 +++ new/strictures-1.004004/Changes 2012-11-12 20:05:20.000000000 +0100 @@ -1,3 +1,14 @@ +1.004004 - 2012-11-12 + - fix 5.16 crash due to qw() list being readonly +1.004003 - 2012-11-10 + - check only once for presence of extra testing prereqs + - explicitly specify no dynamic_config in META +1.004002 - 2012-09-08 + - add better rationale for the extra testing heuristic +1.004001 - 2012-07-12 + - test-specific strictures now enabled during 'dzil test' +1.004000 - 2012-07-12 + - switch to testing calling file to avoid firing on dependencies 1.003001 - 2012-04-08 - fix test to handle defatalization 1.003000 - 2012-04-07 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/strictures-1.003001/MANIFEST new/strictures-1.004004/MANIFEST --- old/strictures-1.003001/MANIFEST 2012-04-08 21:07:03.000000000 +0200 +++ new/strictures-1.004004/MANIFEST 2012-11-12 20:05:36.000000000 +0100 @@ -5,7 +5,11 @@ maint/Makefile.PL.include Makefile.PL MANIFEST This list of files +t/crash.t t/smells-of-vcs/.exists +t/smells-of-vcs/lib/one.pm +t/smells-of-vcs/other/one.pl +t/smells-of-vcs/t/one.faket t/strictures.t xt/pod.t META.yml Module YAML meta-data (added by MakeMaker) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/strictures-1.003001/META.json new/strictures-1.004004/META.json --- old/strictures-1.003001/META.json 2012-04-08 21:07:02.000000000 +0200 +++ new/strictures-1.004004/META.json 2012-11-12 20:05:35.000000000 +0100 @@ -3,8 +3,8 @@ "author" : [ "mst - Matt S. Trout (cpan:MSTROUT) <m...@shadowcat.co.uk>" ], - "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.120921", + "dynamic_config" : 0, + "generated_by" : "ExtUtils::MakeMaker version 6.6302, CPAN::Meta::Converter version 2.120921", "license" : [ "perl_5" ], @@ -31,9 +31,20 @@ } }, "runtime" : { + "recommends" : { + "bareword::filehandles" : "0", + "indirect" : "0", + "multidimensional" : "0" + }, "requires" : {} } }, "release_status" : "stable", - "version" : "1.003001" + "resources" : { + "homepage" : "http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/strictures.git", + "repository" : { + "url" : "git://git.shadowcat.co.uk/p5sagit/strictures.git" + } + }, + "version" : "1.004004" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/strictures-1.003001/META.yml new/strictures-1.004004/META.yml --- old/strictures-1.003001/META.yml 2012-04-08 21:07:02.000000000 +0200 +++ new/strictures-1.004004/META.yml 2012-11-12 20:05:35.000000000 +0100 @@ -6,8 +6,8 @@ ExtUtils::MakeMaker: 0 configure_requires: ExtUtils::MakeMaker: 0 -dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.120921' +dynamic_config: 0 +generated_by: 'ExtUtils::MakeMaker version 6.6302, CPAN::Meta::Converter version 2.120921' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -17,5 +17,12 @@ directory: - t - inc +recommends: + bareword::filehandles: 0 + indirect: 0 + multidimensional: 0 requires: {} -version: 1.003001 +resources: + homepage: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/strictures.git + repository: git://git.shadowcat.co.uk/p5sagit/strictures.git +version: 1.004004 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/strictures-1.003001/Makefile.PL new/strictures-1.004004/Makefile.PL --- old/strictures-1.003001/Makefile.PL 2011-02-16 01:43:55.000000000 +0100 +++ new/strictures-1.004004/Makefile.PL 2012-11-10 19:34:06.000000000 +0100 @@ -7,4 +7,20 @@ WriteMakefile( NAME => 'strictures', VERSION_FROM => 'lib/strictures.pm', + + META_MERGE => { + dynamic_config => 0, + + resources => { + # r/w: p5sa...@git.shadowcat.co.uk:strictures.git + repository => 'git://git.shadowcat.co.uk/p5sagit/strictures.git', + homepage => 'http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/strictures.git', + }, + + recommends => { + indirect => 0, + multidimensional => 0, + 'bareword::filehandles' => 0, + }, + }, ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/strictures-1.003001/README new/strictures-1.004004/README --- old/strictures-1.003001/README 2012-04-08 21:07:02.000000000 +0200 +++ new/strictures-1.004004/README 2012-11-12 20:05:35.000000000 +0100 @@ -9,14 +9,16 @@ use strict; use warnings FATAL => 'all'; - except when called from a file where $0 matches: + except when called from a file which matches: - /^x?t\/.*\.t$/ + (caller)[1] =~ /^(?:t|xt|lib|blib)/ - and when either '.git' or '.svn' is present in the current directory - (with the intention of only forcing extra tests on the author side) - or - when the PERL_STRICTURES_EXTRA environment variable is set, in which - case + and when either ".git" or ".svn" is present in the current directory + (with the intention of only forcing extra tests on the author side) -- + or when ".git" or ".svn" is present two directories up along with + "dist.ini" (which would indicate we are in a "dzil test" operation, via + Dist::Zilla) -- or when the "PERL_STRICTURES_EXTRA" environment variable + is set, in which case use strictures 1; @@ -28,26 +30,26 @@ no multidimensional; no bareword::filehandles; - Note that _EXTRA may at some point add even more tests, with only a - minor version increase, but any changes to the effect of 'use - strictures' in normal mode will involve a major version bump. + Note that "PERL_STRICTURES_EXTRA" may at some point add even more tests, + with only a minor version increase, but any changes to the effect of + "use strictures" in normal mode will involve a major version bump. If any of the extra testing modules are not present, strictures will - complain loudly, once, via warn(), and then shut up. But you really + complain loudly, once, via "warn()", and then shut up. But you really should consider installing them, they're all great anti-footgun tools. DESCRIPTION I've been writing the equivalent of this module at the top of my code for about a year now. I figured it was time to make it shorter. - Things like the importer in 'use Moose' don't help me because they turn - warnings on but don't make them fatal - which from my point of view is - useless because I want an exception to tell me my code isn't warnings - clean. + Things like the importer in "use Moose" don't help me because they turn + warnings on but don't make them fatal -- which from my point of view is + useless because I want an exception to tell me my code isn't + warnings-clean. Any time I see a warning from my code, that indicates a mistake. - Any time my code encounters a mistake, I want a crash - not spew to + Any time my code encounters a mistake, I want a crash -- not spew to STDERR and then unknown (and probably undesired) subsequent behaviour. I also want to ensure that obvious coding mistakes, like indirect object @@ -56,18 +58,18 @@ not at the cost of blowing things up on another machine. Therefore, strictures turns on additional checking, but only when it - thinks it's running in a test file in a VCS checkout - though if this + thinks it's running in a test file in a VCS checkout -- although if this causes undesired behaviour this can be overridden by setting the - PERL_STRICTURES_EXTRA environment variable. + "PERL_STRICTURES_EXTRA" environment variable. If additional useful author side checks come to mind, I'll add them to - the _EXTRA code path only - this will result in a minor version increase - (i.e. 1.000000 to 1.001000 (1.1.0) or similar). Any fixes only to the - mechanism of this code will result in a subversion increas (i.e. - 1.000000 to 1.000001 (1.0.1)). + the "PERL_STRICTURES_EXTRA" code path only -- this will result in a + minor version increase (e.g. 1.000000 to 1.001000 (1.1.0) or similar). + Any fixes only to the mechanism of this code will result in a + sub-version increase (e.g. 1.000000 to 1.000001 (1.0.1)). - If the behaviour of 'use strictures' in normal mode changes in any way, - that will constitute a major version increase - and the code already + If the behaviour of "use strictures" in normal mode changes in any way, + that will constitute a major version increase -- and the code already checks when its version is tested to ensure that use strictures 1; @@ -80,8 +82,62 @@ This method does the setup work described above in "DESCRIPTION" VERSION - This method traps the strictures->VERSION(1) call produced by a use line - with a version number on it and does the version check. + This method traps the "strictures->VERSION(1)" call produced by a use + line with a version number on it and does the version check. + +EXTRA TESTING RATIONALE + Every so often, somebody complains that they're deploying via "git pull" + and that they don't want strictures to enable itself in this case -- and + that setting "PERL_STRICTURES_EXTRA" to 0 isn't acceptable (additional + ways to disable extra testing would be welcome but the discussion never + seems to get that far). + + In order to allow us to skip a couple of stages and get straight to a + productive conversation, here's my current rationale for turning the + extra testing on via a heuristic: + + The extra testing is all stuff that only ever blows up at compile time; + this is intentional. So the oft-raised concern that it's different code + being tested is only sort of the case -- none of the modules involved + affect the final optree to my knowledge, so the author gets some + additional compile time crashes which he/she then fixes, and the rest of + the testing is completely valid for all environments. + + The point of the extra testing -- especially "no indirect" -- is to + catch mistakes that newbie users won't even realise are mistakes without + help. For example, + + foo { ... }; + + where foo is an & prototyped sub that you forgot to import -- this is + pernicious to track down since all *seems* fine until it gets called and + you get a crash. Worse still, you can fail to have imported it due to a + circular require, at which point you have a load order dependent bug + which I've seen before now *only* show up in production due to tiny + differences between the production and the development environment. I + wrote <http://shadow.cat/blog/matt-s-trout/indirect-but-still-fatal/> to + explain this particular problem before strictures itself existed. + + As such, in my experience so far strictures' extra testing has *avoided* + production versus development differences, not caused them. + + Additionally, strictures' policy is very much "try and provide as much + protection as possible for newbies -- who won't think about whether + there's an option to turn on or not" -- so having only the environment + variable is not sufficient to achieve that (I get to explain that you + need to add "use strict" at least once a week on freenode #perl -- + newbies sometimes completely skip steps because they don't understand + that that step is important). + + I make no claims that the heuristic is perfect -- it's already been + evolved significantly over time, especially for 1.004 where we changed + things to ensure it only fires on files in your checkout (rather than + strictures-using modules you happened to have installed, which was just + silly). However, I hope the above clarifies why a heuristic approach is + not only necessary but desirable from a point of view of providing new + users with as much safety as possible, and will allow any future + discussion on the subject to focus on "how do we minimise annoyance to + people deploying from checkouts intentionally". COMMUNITY AND SUPPORT IRC channel @@ -94,6 +150,10 @@ git clone git://git.shadowcat.co.uk/p5sagit/strictures.git + The web interface to the repository is at: + + http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/strictures.git + AUTHOR mst - Matt S. Trout (cpan:MSTROUT) <m...@shadowcat.co.uk> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/strictures-1.003001/lib/strictures.pm new/strictures-1.004004/lib/strictures.pm --- old/strictures-1.003001/lib/strictures.pm 2012-04-08 21:05:44.000000000 +0200 +++ new/strictures-1.004004/lib/strictures.pm 2012-11-12 20:04:07.000000000 +0100 @@ -5,7 +5,7 @@ use constant _PERL_LT_5_8_4 => ($] < 5.008004) ? 1 : 0; -our $VERSION = '1.003001'; # 1.3.1 +our $VERSION = '1.004004'; # 1.4.4 sub VERSION { for ($_[1]) { @@ -21,7 +21,10 @@ shift->SUPER::VERSION(@_); } -my $extras_load_warned; +my $extra_load_states; + +our $Smells_Like_VCS = (-e '.git' || -e '.svn' + || (-e '../../dist.ini' && (-e '../../.git' || -e '../../.svn'))); sub import { strict->import; @@ -30,47 +33,54 @@ my $extra_tests = do { if (exists $ENV{PERL_STRICTURES_EXTRA}) { if (_PERL_LT_5_8_4 and $ENV{PERL_STRICTURES_EXTRA}) { - die 'PERL_STRICTUTRES_EXTRA checks are not available on perls older than 5.8.4, ' + die 'PERL_STRICTURES_EXTRA checks are not available on perls older than 5.8.4: ' . "please unset \$ENV{PERL_STRICTURES_EXTRA}\n"; } $ENV{PERL_STRICTURES_EXTRA}; } elsif (! _PERL_LT_5_8_4) { - !!($0 =~ /^x?t\/.*\.t$/ - and (-e '.git' or -e '.svn')) + !!((caller)[1] =~ /^(?:t|xt|lib|blib)/ + and $Smells_Like_VCS) } }; if ($extra_tests) { - my @failed; - if (eval { require indirect; 1 }) { - indirect->unimport(':fatal'); - } else { - push @failed, 'indirect'; - } - if (eval { require multidimensional; 1 }) { - multidimensional->unimport; - } else { - push @failed, 'multidimensional'; - } - if (eval { require bareword::filehandles; 1 }) { - bareword::filehandles->unimport; - } else { - push @failed, 'bareword::filehandles'; - } - if (@failed and not $extras_load_warned++) { - my $failed = join ' ', @failed; - warn <<EOE; + $extra_load_states ||= do { + + my (%rv, @failed); + foreach my $mod (qw(indirect multidimensional bareword::filehandles)) { + eval "require $mod; \$rv{'$mod'} = 1;" or do { + push @failed, $mod; + + # courtesy of the 5.8 require bug + # (we do a copy because 5.16.2 at least uses the same read-only + # scalars for the qw() list and it doesn't seem worth a $^V check) + + (my $file = $mod) =~ s|::|/|g; + delete $INC{"${file}.pm"}; + }; + } + + if (@failed) { + my $failed = join ' ', @failed; + print STDERR <<EOE; strictures.pm extra testing active but couldn't load all modules. Missing were: $failed Extra testing is auto-enabled in checkouts only, so if you're the author -of a strictures using module you need to run: +of a strictures-using module you need to run: cpan indirect multidimensional bareword::filehandles but these modules are not required by your users. EOE - } + } + + \%rv; + }; + + indirect->unimport(':fatal') if $extra_load_states->{indirect}; + multidimensional->unimport if $extra_load_states->{multidimensional}; + bareword::filehandles->unimport if $extra_load_states->{'bareword::filehandles'}; } } @@ -90,13 +100,15 @@ use strict; use warnings FATAL => 'all'; -except when called from a file where $0 matches: +except when called from a file which matches: - /^x?t\/.*\.t$/ + (caller)[1] =~ /^(?:t|xt|lib|blib)/ -and when either '.git' or '.svn' is present in the current directory (with -the intention of only forcing extra tests on the author side) - or when the -PERL_STRICTURES_EXTRA environment variable is set, in which case +and when either C<.git> or C<.svn> is present in the current directory (with +the intention of only forcing extra tests on the author side) -- or when C<.git> +or C<.svn> is present two directories up along with C<dist.ini> (which would +indicate we are in a C<dzil test> operation, via L<Dist::Zilla>) -- +or when the C<PERL_STRICTURES_EXTRA> environment variable is set, in which case use strictures 1; @@ -108,12 +120,12 @@ no multidimensional; no bareword::filehandles; -Note that _EXTRA may at some point add even more tests, with only a minor -version increase, but any changes to the effect of 'use strictures' in +Note that C<PERL_STRICTURES_EXTRA> may at some point add even more tests, with only a minor +version increase, but any changes to the effect of C<use strictures> in normal mode will involve a major version bump. -If any of the extra testing modules are not present, strictures will -complain loudly, once, via warn(), and then shut up. But you really +If any of the extra testing modules are not present, L<strictures> will +complain loudly, once, via C<warn()>, and then shut up. But you really should consider installing them, they're all great anti-footgun tools. =head1 DESCRIPTION @@ -121,13 +133,13 @@ I've been writing the equivalent of this module at the top of my code for about a year now. I figured it was time to make it shorter. -Things like the importer in 'use Moose' don't help me because they turn -warnings on but don't make them fatal - which from my point of view is -useless because I want an exception to tell me my code isn't warnings clean. +Things like the importer in C<use Moose> don't help me because they turn +warnings on but don't make them fatal -- which from my point of view is +useless because I want an exception to tell me my code isn't warnings-clean. Any time I see a warning from my code, that indicates a mistake. -Any time my code encounters a mistake, I want a crash - not spew to STDERR +Any time my code encounters a mistake, I want a crash -- not spew to STDERR and then unknown (and probably undesired) subsequent behaviour. I also want to ensure that obvious coding mistakes, like indirect object @@ -135,19 +147,19 @@ as such) get caught, but not at the cost of an XS dependency and not at the cost of blowing things up on another machine. -Therefore, strictures turns on additional checking, but only when it thinks -it's running in a test file in a VCS checkout - though if this causes +Therefore, L<strictures> turns on additional checking, but only when it thinks +it's running in a test file in a VCS checkout -- although if this causes undesired behaviour this can be overridden by setting the -PERL_STRICTURES_EXTRA environment variable. +C<PERL_STRICTURES_EXTRA> environment variable. If additional useful author side checks come to mind, I'll add them to the -_EXTRA code path only - this will result in a minor version increase (i.e. +C<PERL_STRICTURES_EXTRA> code path only -- this will result in a minor version increase (e.g. 1.000000 to 1.001000 (1.1.0) or similar). Any fixes only to the mechanism of -this code will result in a subversion increas (i.e. 1.000000 to 1.000001 +this code will result in a sub-version increase (e.g. 1.000000 to 1.000001 (1.0.1)). -If the behaviour of 'use strictures' in normal mode changes in any way, that -will constitute a major version increase - and the code already checks +If the behaviour of C<use strictures> in normal mode changes in any way, that +will constitute a major version increase -- and the code already checks when its version is tested to ensure that use strictures 1; @@ -163,9 +175,63 @@ =head2 VERSION -This method traps the strictures->VERSION(1) call produced by a use line +This method traps the C<< strictures->VERSION(1) >> call produced by a use line with a version number on it and does the version check. +=head1 EXTRA TESTING RATIONALE + +Every so often, somebody complains that they're deploying via C<git pull> +and that they don't want L<strictures> to enable itself in this case -- and that +setting C<PERL_STRICTURES_EXTRA> to 0 isn't acceptable (additional ways to +disable extra testing would be welcome but the discussion never seems to get +that far). + +In order to allow us to skip a couple of stages and get straight to a +productive conversation, here's my current rationale for turning the +extra testing on via a heuristic: + +The extra testing is all stuff that only ever blows up at compile time; +this is intentional. So the oft-raised concern that it's different code being +tested is only sort of the case -- none of the modules involved affect the +final optree to my knowledge, so the author gets some additional compile +time crashes which he/she then fixes, and the rest of the testing is +completely valid for all environments. + +The point of the extra testing -- especially C<no indirect> -- is to catch +mistakes that newbie users won't even realise are mistakes without +help. For example, + + foo { ... }; + +where foo is an & prototyped sub that you forgot to import -- this is +pernicious to track down since all I<seems> fine until it gets called +and you get a crash. Worse still, you can fail to have imported it due +to a circular require, at which point you have a load order dependent +bug which I've seen before now I<only> show up in production due to tiny +differences between the production and the development environment. I wrote +L<http://shadow.cat/blog/matt-s-trout/indirect-but-still-fatal/> to explain +this particular problem before L<strictures> itself existed. + +As such, in my experience so far L<strictures>' extra testing has +I<avoided> production versus development differences, not caused them. + +Additionally, L<strictures>' policy is very much "try and provide as much +protection as possible for newbies -- who won't think about whether there's +an option to turn on or not" -- so having only the environment variable +is not sufficient to achieve that (I get to explain that you need to add +C<use strict> at least once a week on freenode #perl -- newbies sometimes +completely skip steps because they don't understand that that step +is important). + +I make no claims that the heuristic is perfect -- it's already been evolved +significantly over time, especially for 1.004 where we changed things to +ensure it only fires on files in your checkout (rather than L<strictures>-using +modules you happened to have installed, which was just silly). However, I +hope the above clarifies why a heuristic approach is not only necessary but +desirable from a point of view of providing new users with as much safety as possible, +and will allow any future discussion on the subject to focus on "how do we +minimise annoyance to people deploying from checkouts intentionally". + =head1 COMMUNITY AND SUPPORT =head2 IRC channel @@ -180,6 +246,10 @@ git clone git://git.shadowcat.co.uk/p5sagit/strictures.git +The web interface to the repository is at: + + http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/strictures.git + =head1 AUTHOR mst - Matt S. Trout (cpan:MSTROUT) <m...@shadowcat.co.uk> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/strictures-1.003001/maint/Makefile.PL.include new/strictures-1.004004/maint/Makefile.PL.include --- old/strictures-1.003001/maint/Makefile.PL.include 2012-04-07 16:53:16.000000000 +0200 +++ new/strictures-1.004004/maint/Makefile.PL.include 2012-07-12 22:52:17.000000000 +0200 @@ -5,5 +5,5 @@ author 'mst - Matt S. Trout (cpan:MSTROUT) <m...@shadowcat.co.uk>'; manifest_include( - '' => qr{t/smells-of-vcs/.exists}, + 't/smells-of-vcs' => qr{.*}, ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/strictures-1.003001/t/crash.t new/strictures-1.004004/t/crash.t --- old/strictures-1.003001/t/crash.t 1970-01-01 01:00:00.000000000 +0100 +++ new/strictures-1.004004/t/crash.t 2012-11-12 20:01:17.000000000 +0100 @@ -0,0 +1,16 @@ +use strictures; + +use Test::More tests => 1; + +SKIP: { + skip 'Have all the modules; can\'t check this', 1 + unless not eval { + require indirect; + require multidimensional; + require bareword::filehandles; + 1; + }; + + pass('can manage to survive with some modules missing!'); +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/strictures-1.003001/t/smells-of-vcs/lib/one.pm new/strictures-1.004004/t/smells-of-vcs/lib/one.pm --- old/strictures-1.003001/t/smells-of-vcs/lib/one.pm 1970-01-01 01:00:00.000000000 +0100 +++ new/strictures-1.004004/t/smells-of-vcs/lib/one.pm 2012-07-13 01:47:13.000000000 +0200 @@ -0,0 +1,5 @@ +package one; + +use strictures 1; + +new Foo 1, 2, 3; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/strictures-1.003001/t/smells-of-vcs/other/one.pl new/strictures-1.004004/t/smells-of-vcs/other/one.pl --- old/strictures-1.003001/t/smells-of-vcs/other/one.pl 1970-01-01 01:00:00.000000000 +0100 +++ new/strictures-1.004004/t/smells-of-vcs/other/one.pl 2012-07-13 01:47:13.000000000 +0200 @@ -0,0 +1,3 @@ +use strictures 1; + +new Foo 1, 2, 3; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/strictures-1.003001/t/smells-of-vcs/t/one.faket new/strictures-1.004004/t/smells-of-vcs/t/one.faket --- old/strictures-1.003001/t/smells-of-vcs/t/one.faket 1970-01-01 01:00:00.000000000 +0100 +++ new/strictures-1.004004/t/smells-of-vcs/t/one.faket 2012-11-10 18:20:45.000000000 +0100 @@ -0,0 +1,3 @@ +use strictures 1; + +new Foo 1, 2, 3; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/strictures-1.003001/t/strictures.t new/strictures-1.004004/t/strictures.t --- old/strictures-1.003001/t/strictures.t 2012-04-08 21:04:30.000000000 +0200 +++ new/strictures-1.004004/t/strictures.t 2012-11-10 18:20:45.000000000 +0100 @@ -1,3 +1,5 @@ +BEGIN { delete $ENV{PERL_STRICTURES_EXTRA} } + # -e is sufficient here. -e 't/smells-of-vcs/.git' or mkdir('t/smells-of-vcs/.git') @@ -13,8 +15,10 @@ sub capture_expect { push @expect, capture_stuff } { + BEGIN { $ENV{PERL_STRICTURES_EXTRA} = 0 } use strictures 1; BEGIN { capture_us } + BEGIN { delete $ENV{PERL_STRICTURES_EXTRA} } } { @@ -40,16 +44,14 @@ require bareword::filehandles; 1; }; - local $0 = 't/00load.t'; sub Foo::new { 1 } chdir("t/smells-of-vcs"); - my $r = eval q{ - use strictures 1; - new Foo 1, 2, 3; - }; - # I don't test $@ here since if indirect isn't installed we hit one - # error and if it is we hit another; it's enough the code path's hit. - ok(!$r, 'strictures blows up for t/00load.t'); + local $strictures::Smells_Like_VCS = 1; + foreach my $file (qw(lib/one.pm t/one.faket)) { + ok(!eval { require $file; 1 }, "Failed to load ${file}"); + like($@, qr{Indirect call of method}, "Failed due to indirect.pm, ok"); + } + ok(eval { require "other/one.pl"; 1 }, "Loaded other/one.pl ok"); } ok(!eval q{use strictures 2; 1; }, "Can't use strictures 2 (this is version 1)"); -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org