[Bast-commits] r6210 - in DBIx-Class/0.08/branches/hierarchical-queries: . lib/DBIx/Class/Relationship t t/lib t/lib/DBICTest

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Mon May 11 15:09:19 GMT 2009


Author: caelum
Date: 2009-05-11 15:09:19 +0000 (Mon, 11 May 2009)
New Revision: 6210

Added:
   DBIx-Class/0.08/branches/hierarchical-queries/t/lib/DBICTest/AuthorCheck.pm
Modified:
   DBIx-Class/0.08/branches/hierarchical-queries/
   DBIx-Class/0.08/branches/hierarchical-queries/Makefile.PL
   DBIx-Class/0.08/branches/hierarchical-queries/lib/DBIx/Class/Relationship/ManyToMany.pm
   DBIx-Class/0.08/branches/hierarchical-queries/t/04dont_break_c3.t
   DBIx-Class/0.08/branches/hierarchical-queries/t/103many_to_many_warning.t
   DBIx-Class/0.08/branches/hierarchical-queries/t/39load_namespaces_1.t
   DBIx-Class/0.08/branches/hierarchical-queries/t/39load_namespaces_2.t
   DBIx-Class/0.08/branches/hierarchical-queries/t/39load_namespaces_3.t
   DBIx-Class/0.08/branches/hierarchical-queries/t/39load_namespaces_4.t
   DBIx-Class/0.08/branches/hierarchical-queries/t/39load_namespaces_rt41083.t
   DBIx-Class/0.08/branches/hierarchical-queries/t/41orrible.t
   DBIx-Class/0.08/branches/hierarchical-queries/t/42toplimit.t
   DBIx-Class/0.08/branches/hierarchical-queries/t/94versioning.t
   DBIx-Class/0.08/branches/hierarchical-queries/t/lib/DBICTest.pm
   DBIx-Class/0.08/branches/hierarchical-queries/t/zzzzzzz_perl_perf_bug.t
Log:
 r2516 at hlagh (orig r6201):  ribasushi | 2009-05-10 10:57:31 -0700
 Require DBICTest.pm in all tests even if it is not needed at all
 r2517 at hlagh (orig r6202):  ribasushi | 2009-05-10 11:17:09 -0700
 No more 'I forgot to run perl Makefile.PL'
 r2518 at hlagh (orig r6203):  ribasushi | 2009-05-10 12:35:03 -0700
 Switch the m2m method warnings from warnings::register to $ENV{DBIC_METHOD_CLOBBER_OK} = 1
 r2519 at hlagh (orig r6205):  ribasushi | 2009-05-11 03:50:54 -0700
 Change the makefile to test r6202



Property changes on: DBIx-Class/0.08/branches/hierarchical-queries
___________________________________________________________________
Name: svk:merge
   - 168d5346-440b-0410-b799-f706be625ff1:/DBIx-Class-current:2207
462d4d0c-b505-0410-bf8e-ce8f877b3390:/local/bast/DBIx-Class:3159
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/branches/resultsetcolumn_custom_columns:5160
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/branches/sqla_1.50_compat:5414
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/trunk:5969
9c88509d-e914-0410-b01c-b9530614cbfe:/local/DBIx-Class:32260
9c88509d-e914-0410-b01c-b9530614cbfe:/local/DBIx-Class-CDBICompat:54993
9c88509d-e914-0410-b01c-b9530614cbfe:/vendor/DBIx-Class:31122
ab17426e-7cd3-4704-a2a2-80b7c0a611bb:/local/dbic_column_attr:10946
ab17426e-7cd3-4704-a2a2-80b7c0a611bb:/local/dbic_trunk:11142
bd5ac9a7-f185-4d95-9186-dbb8b392a572:/local/os/bast/DBIx-Class/0.08/trunk:2798
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/belongs_to_null_col_fix:5244
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/cdbicompat_integration:4160
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/column_attr:5074
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/complex_join_rels:4589
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/file_column:3920
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/fix-update-and-delete-as_query:6162
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/multi_stuff:5565
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/on_disconnect_do:3694
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/oracle_sequence:4173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/parser_fk_index:4485
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/prefetch:5699
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/replication_dedux:4600
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/rt_bug_41083:5437
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/savepoints:4223
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sqla_1.50_compat:5321
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/storage-ms-access:4142
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/subclassed_rsset:5930
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/subquery:5617
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sybase:5651
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sybase_mssql:6125
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/versioned_enhancements:4125
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/versioning:4578
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/views:5585
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/trunk:6198
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-C3:318
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-current:2222
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-joins:173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-resultset:570
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/datetime:1716
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/find_compat:1855
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/find_unique_query_fixes:2142
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/inflate:1988
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/many_to_many:2025
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/re_refactor_bugfix:1944
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/reorganize_tests:1827
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset-new-refactor:1766
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset_2_electric_boogaloo:2175
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset_cleanup:2102
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/sqlt_tests_refactor:2043
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/trunk/DBIx-Class:3606
fe160bb6-dc1c-0410-9f2b-d64a711b54a5:/local/DBIC-trunk-0.08:10510
   + 168d5346-440b-0410-b799-f706be625ff1:/DBIx-Class-current:2207
462d4d0c-b505-0410-bf8e-ce8f877b3390:/local/bast/DBIx-Class:3159
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/branches/resultsetcolumn_custom_columns:5160
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/branches/sqla_1.50_compat:5414
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/trunk:5969
9c88509d-e914-0410-b01c-b9530614cbfe:/local/DBIx-Class:32260
9c88509d-e914-0410-b01c-b9530614cbfe:/local/DBIx-Class-CDBICompat:54993
9c88509d-e914-0410-b01c-b9530614cbfe:/vendor/DBIx-Class:31122
ab17426e-7cd3-4704-a2a2-80b7c0a611bb:/local/dbic_column_attr:10946
ab17426e-7cd3-4704-a2a2-80b7c0a611bb:/local/dbic_trunk:11142
bd5ac9a7-f185-4d95-9186-dbb8b392a572:/local/os/bast/DBIx-Class/0.08/trunk:2798
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/belongs_to_null_col_fix:5244
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/cdbicompat_integration:4160
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/column_attr:5074
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/complex_join_rels:4589
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/file_column:3920
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/fix-update-and-delete-as_query:6162
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/multi_stuff:5565
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/on_disconnect_do:3694
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/oracle_sequence:4173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/parser_fk_index:4485
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/prefetch:5699
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/replication_dedux:4600
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/rt_bug_41083:5437
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/savepoints:4223
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sqla_1.50_compat:5321
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/storage-ms-access:4142
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/subclassed_rsset:5930
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/subquery:5617
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sybase:5651
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sybase_mssql:6125
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/versioned_enhancements:4125
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/versioning:4578
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/views:5585
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/trunk:6205
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-C3:318
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-current:2222
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-joins:173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-resultset:570
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/datetime:1716
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/find_compat:1855
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/find_unique_query_fixes:2142
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/inflate:1988
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/many_to_many:2025
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/re_refactor_bugfix:1944
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/reorganize_tests:1827
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset-new-refactor:1766
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset_2_electric_boogaloo:2175
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset_cleanup:2102
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/sqlt_tests_refactor:2043
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/trunk/DBIx-Class:3606
fe160bb6-dc1c-0410-9f2b-d64a711b54a5:/local/DBIC-trunk-0.08:10510

Modified: DBIx-Class/0.08/branches/hierarchical-queries/Makefile.PL
===================================================================
--- DBIx-Class/0.08/branches/hierarchical-queries/Makefile.PL	2009-05-11 14:24:27 UTC (rev 6209)
+++ DBIx-Class/0.08/branches/hierarchical-queries/Makefile.PL	2009-05-11 15:09:19 UTC (rev 6210)
@@ -190,6 +190,7 @@
             . 'Do you really want to continue?',
             'no',
           );
+
           exit 0 unless ($ans =~ /^y(es)?$/i);
       }
     }

Modified: DBIx-Class/0.08/branches/hierarchical-queries/lib/DBIx/Class/Relationship/ManyToMany.pm
===================================================================
--- DBIx-Class/0.08/branches/hierarchical-queries/lib/DBIx/Class/Relationship/ManyToMany.pm	2009-05-11 14:24:27 UTC (rev 6209)
+++ DBIx-Class/0.08/branches/hierarchical-queries/lib/DBIx/Class/Relationship/ManyToMany.pm	2009-05-11 15:09:19 UTC (rev 6210)
@@ -3,7 +3,8 @@
 
 use strict;
 use warnings;
-use warnings::register;
+
+use Carp::Clan qw/^DBIx::Class/;
 use Sub::Name ();
 
 sub many_to_many {
@@ -28,16 +29,20 @@
 
     for ($add_meth, $remove_meth, $set_meth, $rs_meth) {
       if ( $class->can ($_) ) {
-        warnings::warnif(<<"EOW")
+        carp (<<"EOW") unless $ENV{DBIC_METHOD_CLOBBER_OK};
+
 ***************************************************************************
-The many-to-many relationship $meth is trying to create a utility method called
-$_. This will overwrite the existing method on $class. You almost certainly
-want to rename your method or the many-to-many relationship, as your method
-will not be callable (it will use the one from the relationship instead.)
+The many-to-many relationship '$meth' is trying to create a utility method
+called $_.
+This will completely overwrite one such already existing method on class
+$class.
 
-To disable this warning add the following to $class
+You almost certainly want to rename your method or the many-to-many
+relationship, as the functionality of the original method will not be
+accessible anymore.
 
-  no warnings 'DBIx::Class::Relationship::ManyToMany';
+To disable this warning set the environment variable DBIC_METHOD_CLOBBER_OK
+to a true value
 
 ***************************************************************************
 EOW

Modified: DBIx-Class/0.08/branches/hierarchical-queries/t/04dont_break_c3.t
===================================================================
--- DBIx-Class/0.08/branches/hierarchical-queries/t/04dont_break_c3.t	2009-05-11 14:24:27 UTC (rev 6209)
+++ DBIx-Class/0.08/branches/hierarchical-queries/t/04dont_break_c3.t	2009-05-11 15:09:19 UTC (rev 6210)
@@ -1,11 +1,11 @@
-#!/usr/bin/perl -w
-#Simon Ilyushchenko, 12/05/05
-#Testing the case when we try to inject into @ISA a class that's already a parent of the target class.
 
 use strict;
 use Test::More tests => 2;
 use MRO::Compat;
 
+use lib qw(t/lib);
+use DBICTest; # do not remove even though it is not used
+
 {
 package AAA;
 

Modified: DBIx-Class/0.08/branches/hierarchical-queries/t/103many_to_many_warning.t
===================================================================
--- DBIx-Class/0.08/branches/hierarchical-queries/t/103many_to_many_warning.t	2009-05-11 14:24:27 UTC (rev 6209)
+++ DBIx-Class/0.08/branches/hierarchical-queries/t/103many_to_many_warning.t	2009-05-11 15:09:19 UTC (rev 6210)
@@ -5,42 +5,38 @@
 use lib qw(t/lib);
 use Data::Dumper;
 
-plan ( ($] >= 5.009000 and $] < 5.010001)
-  ? (skip_all => 'warnings::register broken under 5.10: http://rt.perl.org/rt3/Public/Bug/Display.html?id=62522')
-  : (tests => 4)
-);
+plan tests => 4;
+my $exp_warn = qr/The many-to-many relationship 'bars' is trying to create/;
 
 {
   my @w; 
-  local $SIG{__WARN__} = sub { push @w, @_ };
+  local $SIG{__WARN__} = sub { $_[0] =~ $exp_warn ? push @w, $_[0] : warn $_[0] };
   my $code = gen_code ( suffix => 1 );
   eval "$code";
   ok (! $@, 'Eval code without warnings suppression')
     || diag $@;
 
-  ok ( (grep { $_ =~ /The many-to-many relationship bars is trying to create/ } @w), "Warning triggered without relevant 'no warnings'");
+  ok (@w, "Warning triggered without DBIC_METHOD_CLOBBER_OK");
 }
 
 {
   my @w; 
-  local $SIG{__WARN__} = sub { push @w, @_ };
+  local $SIG{__WARN__} = sub { $_[0] =~ $exp_warn ? push @w, $_[0] : warn $_[0] };
 
-  my $code = gen_code ( suffix => 2, no_warn => 1 );
+  my $code = gen_code ( suffix => 2 );
+
+  local $ENV{DBIC_METHOD_CLOBBER_OK} = 1;
   eval "$code";
   ok (! $@, 'Eval code with warnings suppression')
     || diag $@;
 
-  ok ( (not grep { $_ =~ /The many-to-many relationship bars is trying to create/ } @w), "No warning triggered with relevant 'no warnings'");
+  ok (! @w, "No warning triggered with DBIC_METHOD_CLOBBER_OK");
 }
 
 sub gen_code {
 
   my $args = { @_ };
   my $suffix = $args->{suffix};
-  my $no_warn = ( $args->{no_warn}
-    ? "no warnings 'DBIx::Class::Relationship::ManyToMany';"
-    : '',
-  );
 
   return <<EOF;
 use strict;
@@ -95,7 +91,6 @@
     },
   );
 
-  ${no_warn}
   __PACKAGE__->set_primary_key('barid');
   __PACKAGE__->has_many('foo_to_bar' => 'DBICTest::Schema::FooToBar${suffix}' => 'foo');
 

Modified: DBIx-Class/0.08/branches/hierarchical-queries/t/39load_namespaces_1.t
===================================================================
--- DBIx-Class/0.08/branches/hierarchical-queries/t/39load_namespaces_1.t	2009-05-11 14:24:27 UTC (rev 6209)
+++ DBIx-Class/0.08/branches/hierarchical-queries/t/39load_namespaces_1.t	2009-05-11 15:09:19 UTC (rev 6210)
@@ -4,7 +4,8 @@
 use warnings;
 use Test::More;
 
-unshift(@INC, './t/lib');
+use lib qw(t/lib);
+use DBICTest; # do not remove even though it is not used
 
 plan tests => 8;
 

Modified: DBIx-Class/0.08/branches/hierarchical-queries/t/39load_namespaces_2.t
===================================================================
--- DBIx-Class/0.08/branches/hierarchical-queries/t/39load_namespaces_2.t	2009-05-11 14:24:27 UTC (rev 6209)
+++ DBIx-Class/0.08/branches/hierarchical-queries/t/39load_namespaces_2.t	2009-05-11 15:09:19 UTC (rev 6210)
@@ -4,7 +4,8 @@
 use warnings;
 use Test::More;
 
-unshift(@INC, './t/lib');
+use lib qw(t/lib);
+use DBICTest; # do not remove even though it is not used
 
 plan tests => 6;
 

Modified: DBIx-Class/0.08/branches/hierarchical-queries/t/39load_namespaces_3.t
===================================================================
--- DBIx-Class/0.08/branches/hierarchical-queries/t/39load_namespaces_3.t	2009-05-11 14:24:27 UTC (rev 6209)
+++ DBIx-Class/0.08/branches/hierarchical-queries/t/39load_namespaces_3.t	2009-05-11 15:09:19 UTC (rev 6210)
@@ -4,7 +4,8 @@
 use warnings;
 use Test::More;
 
-unshift(@INC, './t/lib');
+use lib qw(t/lib);
+use DBICTest; # do not remove even though it is not used
 
 plan tests => 7;
 

Modified: DBIx-Class/0.08/branches/hierarchical-queries/t/39load_namespaces_4.t
===================================================================
--- DBIx-Class/0.08/branches/hierarchical-queries/t/39load_namespaces_4.t	2009-05-11 14:24:27 UTC (rev 6209)
+++ DBIx-Class/0.08/branches/hierarchical-queries/t/39load_namespaces_4.t	2009-05-11 15:09:19 UTC (rev 6210)
@@ -4,7 +4,8 @@
 use warnings;
 use Test::More;
 
-unshift(@INC, './t/lib');
+use lib qw(t/lib);
+use DBICTest; # do not remove even though it is not used
 
 plan tests => 6;
 

Modified: DBIx-Class/0.08/branches/hierarchical-queries/t/39load_namespaces_rt41083.t
===================================================================
--- DBIx-Class/0.08/branches/hierarchical-queries/t/39load_namespaces_rt41083.t	2009-05-11 14:24:27 UTC (rev 6209)
+++ DBIx-Class/0.08/branches/hierarchical-queries/t/39load_namespaces_rt41083.t	2009-05-11 15:09:19 UTC (rev 6210)
@@ -4,6 +4,7 @@
 use warnings;
 
 use lib 't/lib';
+use DBICTest; # do not remove even though it is not used 
 use Test::More tests => 8;
 
 sub _chk_warning {

Modified: DBIx-Class/0.08/branches/hierarchical-queries/t/41orrible.t
===================================================================
--- DBIx-Class/0.08/branches/hierarchical-queries/t/41orrible.t	2009-05-11 14:24:27 UTC (rev 6209)
+++ DBIx-Class/0.08/branches/hierarchical-queries/t/41orrible.t	2009-05-11 15:09:19 UTC (rev 6210)
@@ -5,6 +5,7 @@
 use DBIx::Class::Storage::DBI::Oracle::WhereJoins;
 
 use lib qw(t/lib);
+use DBICTest; # do not remove even though it is not used
 use DBIC::SqlMakerTest;
 
 plan tests => 4;

Modified: DBIx-Class/0.08/branches/hierarchical-queries/t/42toplimit.t
===================================================================
--- DBIx-Class/0.08/branches/hierarchical-queries/t/42toplimit.t	2009-05-11 14:24:27 UTC (rev 6209)
+++ DBIx-Class/0.08/branches/hierarchical-queries/t/42toplimit.t	2009-05-11 15:09:19 UTC (rev 6210)
@@ -3,6 +3,8 @@
 
 use Test::More;
 use DBIx::Class::Storage::DBI;
+use lib qw(t/lib);
+use DBICTest; # do not remove even though it is not used
 
 plan tests => 1;
 

Modified: DBIx-Class/0.08/branches/hierarchical-queries/t/94versioning.t
===================================================================
--- DBIx-Class/0.08/branches/hierarchical-queries/t/94versioning.t	2009-05-11 14:24:27 UTC (rev 6209)
+++ DBIx-Class/0.08/branches/hierarchical-queries/t/94versioning.t	2009-05-11 15:09:19 UTC (rev 6210)
@@ -33,6 +33,8 @@
 };
 
 use lib qw(t/lib);
+use DBICTest; # do not remove even though it is not used
+
 use_ok('DBICVersionOrig');
 
 my $schema_orig = DBICVersion::Schema->connect($dsn, $user, $pass, { ignore_version => 1 });

Added: DBIx-Class/0.08/branches/hierarchical-queries/t/lib/DBICTest/AuthorCheck.pm
===================================================================
--- DBIx-Class/0.08/branches/hierarchical-queries/t/lib/DBICTest/AuthorCheck.pm	                        (rev 0)
+++ DBIx-Class/0.08/branches/hierarchical-queries/t/lib/DBICTest/AuthorCheck.pm	2009-05-11 15:09:19 UTC (rev 6210)
@@ -0,0 +1,106 @@
+package # hide from PAUSE 
+    DBICTest::AuthorCheck;
+
+use strict;
+use warnings;
+
+use Path::Class qw/file dir/;
+
+_check_author_makefile() unless $ENV{DBICTEST_NO_MAKEFILE_VERIFICATION};
+
+# Die if the author did not update his makefile
+#
+# This is pretty heavy handed, so the check is pretty solid:
+#
+# 1) Assume that this particular module is loaded from -I <$root>/t/lib
+# 2) Make sure <$root>/Makefile.PL exists
+# 3) Make sure we can stat() <$root>/Makefile.PL
+#
+# If all of the above is satisfied
+#
+# *) die if <$root>/inc does not exist
+# *) die if no stat() results for <$root>/Makefile (covers no Makefile)
+# *) die if Makefile.PL mtime > Makefile mtime
+#
+sub _check_author_makefile {
+
+  my $root = _find_co_root()
+    or return;
+
+  # not using file->stat as it invokes File::stat which in turn breaks stat(_)
+  my ($mf_pl_mtime, $mf_mtime) = ( map
+    { (stat ($root->file ($_)) )[9] }
+    qw/Makefile.PL Makefile/
+  );
+
+  return unless $mf_pl_mtime;   # something went wrong during co_root detection ?
+
+  if (
+    not -d $root->subdir ('inc') 
+      or
+    not $mf_mtime
+      or
+    $mf_mtime < $mf_pl_mtime
+  ) {
+    print STDERR <<'EOE';
+
+
+
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+======================== FATAL ERROR ===========================
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+We have a number of reasons to believe that this is a development
+checkout and that you, the user, did not run `perl Makefile.PL`
+before using this code. You absolutely _must_ perform this step,
+as not doing so often results in a lot of wasted time for other
+contributors trying to assit you with "it broke!" problems.
+
+If you are seeing this message unexpectedly (i.e. you are in fact
+attempting a regular installation be it through CPAN or manually,
+set the variable DBICTEST_NO_MAKEFILE_VERIFICATION to a true value
+so you can continue. Also _make_absolutely_sure_ to report this to
+either the mailing list or to the irc channel as described in
+
+http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class.pm#GETTING_HELP/SUPPORT
+
+Failure to do this will make us believe that all these checks are
+indeed foolproof and we will remove the ability to override this
+entirely.
+
+The DBIC team
+
+
+
+EOE
+
+    exit 1;
+  }
+}
+
+# Try to determine the root of a checkout/untar if possible
+# or return undef
+sub _find_co_root {
+
+    my @mod_parts = split /::/, (__PACKAGE__ . '.pm');
+    my $rel_path = file (@mod_parts);
+
+    return undef unless ($INC{$rel_path});
+
+    # a bit convoluted, but what we do here essentially is:
+    #  - get the file name of this particular module
+    #  - do 'cd ..' as many times as necessary to get to t/lib/../..
+
+    my $root = dir ($INC{$rel_path});
+    for (0 .. @mod_parts + 1) {
+        $root = $root->parent;
+    }
+
+    return (-f $root->file ('Makefile.PL') )
+      ? $root
+      : undef
+    ;
+}
+
+1;

Modified: DBIx-Class/0.08/branches/hierarchical-queries/t/lib/DBICTest.pm
===================================================================
--- DBIx-Class/0.08/branches/hierarchical-queries/t/lib/DBICTest.pm	2009-05-11 14:24:27 UTC (rev 6209)
+++ DBIx-Class/0.08/branches/hierarchical-queries/t/lib/DBICTest.pm	2009-05-11 15:09:19 UTC (rev 6210)
@@ -3,6 +3,7 @@
 
 use strict;
 use warnings;
+use DBICTest::AuthorCheck;
 use DBICTest::Schema;
 
 =head1 NAME


Property changes on: DBIx-Class/0.08/branches/hierarchical-queries/t/lib/DBICTest.pm
___________________________________________________________________
Name: svn:executable
   - *

Modified: DBIx-Class/0.08/branches/hierarchical-queries/t/zzzzzzz_perl_perf_bug.t
===================================================================
--- DBIx-Class/0.08/branches/hierarchical-queries/t/zzzzzzz_perl_perf_bug.t	2009-05-11 14:24:27 UTC (rev 6209)
+++ DBIx-Class/0.08/branches/hierarchical-queries/t/zzzzzzz_perl_perf_bug.t	2009-05-11 15:09:19 UTC (rev 6210)
@@ -1,8 +1,8 @@
-#!/usr/bin/perl
 use strict;
 use warnings;
 use Test::More;
 use lib qw(t/lib);
+use DBICTest; # do not remove even though it is not used
 
 # This is a rather unusual test.
 # It does not test any aspect of DBIx::Class, but instead tests the




More information about the Bast-commits mailing list