[Bast-commits] r6214 - in DBIx-Class/0.08/branches/count_distinct:
. lib/DBIx/Class lib/DBIx/Class/CDBICompat
lib/DBIx/Class/Manual lib/DBIx/Class/Relationship
lib/DBIx/Class/Schema lib/DBIx/Class/Storage
lib/DBIx/Class/Storage/DBI lib/SQL/Translator/Parser/DBIx
lib/SQL/Translator/Producer/DBIx/Class t t/lib t/lib/DBICTest
t/lib/DBICTest/Schema
arcanez at dev.catalyst.perl.org
arcanez at dev.catalyst.perl.org
Mon May 11 21:23:47 GMT 2009
Author: arcanez
Date: 2009-05-11 21:23:47 +0000 (Mon, 11 May 2009)
New Revision: 6214
Added:
DBIx-Class/0.08/branches/count_distinct/t/lib/DBICTest/AuthorCheck.pm
DBIx-Class/0.08/branches/count_distinct/t/zzzzzzz_perl_perf_bug.t
Removed:
DBIx-Class/0.08/branches/count_distinct/t/99rh_perl_perf_bug.t
Modified:
DBIx-Class/0.08/branches/count_distinct/
DBIx-Class/0.08/branches/count_distinct/Makefile.PL
DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/CDBICompat/LiveObjectIndex.pm
DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Manual/Cookbook.pod
DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Manual/FAQ.pod
DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Relationship/Base.pm
DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Relationship/ManyToMany.pm
DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/ResultSet.pm
DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/ResultSource.pm
DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/ResultSourceHandle.pm
DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Row.pm
DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Schema/Versioned.pm
DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Storage/DBI.pm
DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Storage/DBI/Cursor.pm
DBIx-Class/0.08/branches/count_distinct/lib/SQL/Translator/Parser/DBIx/Class.pm
DBIx-Class/0.08/branches/count_distinct/lib/SQL/Translator/Producer/DBIx/Class/File.pm
DBIx-Class/0.08/branches/count_distinct/t/04dont_break_c3.t
DBIx-Class/0.08/branches/count_distinct/t/103many_to_many_warning.t
DBIx-Class/0.08/branches/count_distinct/t/39load_namespaces_1.t
DBIx-Class/0.08/branches/count_distinct/t/39load_namespaces_2.t
DBIx-Class/0.08/branches/count_distinct/t/39load_namespaces_3.t
DBIx-Class/0.08/branches/count_distinct/t/39load_namespaces_4.t
DBIx-Class/0.08/branches/count_distinct/t/39load_namespaces_rt41083.t
DBIx-Class/0.08/branches/count_distinct/t/41orrible.t
DBIx-Class/0.08/branches/count_distinct/t/42toplimit.t
DBIx-Class/0.08/branches/count_distinct/t/66relationship.t
DBIx-Class/0.08/branches/count_distinct/t/73oracle_inflate.t
DBIx-Class/0.08/branches/count_distinct/t/94versioning.t
DBIx-Class/0.08/branches/count_distinct/t/lib/DBICTest.pm
DBIx-Class/0.08/branches/count_distinct/t/lib/DBICTest/Schema/CD_to_Producer.pm
DBIx-Class/0.08/branches/count_distinct/t/lib/sqlite.sql
Log:
r6172 at mullet (orig r6171): ribasushi | 2009-05-07 11:49:26 -0700
Cookbook cleanup
r6174 at mullet (orig r6173): ribasushi | 2009-05-08 01:13:30 -0700
Throw away some debugging code
r6175 at mullet (orig r6174): ribasushi | 2009-05-08 01:21:53 -0700
Documentation patch by nniuq
r6176 at mullet (orig r6175): plu | 2009-05-08 01:30:20 -0700
Set NLS_LANG so we have a predictable date format when using MON
r6177 at mullet (orig r6176): ribasushi | 2009-05-08 03:15:15 -0700
Fix POD
r6179 at mullet (orig r6178): jgoulah | 2009-05-08 07:27:49 -0700
renaming rh performance test so it will show up at the end of test output
r6195 at mullet (orig r6194): caelum | 2009-05-09 06:46:55 -0700
added postgres default port stuff to FAQ
r6199 at mullet (orig r6198): mo | 2009-05-10 08:37:16 -0700
set_$rel accepts now a $link_vals hashref like add_to_$rel does
r6202 at mullet (orig r6201): ribasushi | 2009-05-10 10:57:31 -0700
Require DBICTest.pm in all tests even if it is not needed at all
r6203 at mullet (orig r6202): ribasushi | 2009-05-10 11:17:09 -0700
No more 'I forgot to run perl Makefile.PL'
r6204 at mullet (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
r6206 at mullet (orig r6205): ribasushi | 2009-05-11 03:50:54 -0700
Change the makefile to test r6202
Property changes on: DBIx-Class/0.08/branches/count_distinct
___________________________________________________________________
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:6168
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/count_distinct/Makefile.PL
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/Makefile.PL 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/Makefile.PL 2009-05-11 21:23:47 UTC (rev 6214)
@@ -190,6 +190,7 @@
. 'Do you really want to continue?',
'no',
);
+
exit 0 unless ($ans =~ /^y(es)?$/i);
}
}
Modified: DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/CDBICompat/LiveObjectIndex.pm
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/CDBICompat/LiveObjectIndex.pm 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/CDBICompat/LiveObjectIndex.pm 2009-05-11 21:23:47 UTC (rev 6214)
@@ -51,15 +51,15 @@
sub insert {
my ($self, @rest) = @_;
$self->next::method(@rest);
-
+
return $self if $self->nocache;
- # Because the insert will die() if it can't insert into the db (or should)
- # we can be sure the object *was* inserted if we got this far. In which
- # case, given primary keys are unique and ID only returns a
- # value if the object has all its primary keys, we can be sure there
- # isn't a real one in the object index already because such a record
- # cannot have existed without the insert failing.
+ # Because the insert will die() if it can't insert into the db (or should)
+ # we can be sure the object *was* inserted if we got this far. In which
+ # case, given primary keys are unique and ID only returns a
+ # value if the object has all its primary keys, we can be sure there
+ # isn't a real one in the object index already because such a record
+ # cannot have existed without the insert failing.
if (my $key = $self->ID) {
my $live = $self->live_object_index;
weaken($live->{$key} = $self);
@@ -67,7 +67,7 @@
if ++$self->live_object_init_count->{count}
% $self->purge_object_index_every == 0;
}
- #use Data::Dumper; warn Dumper($self);
+
return $self;
}
Modified: DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Manual/Cookbook.pod
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Manual/Cookbook.pod 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Manual/Cookbook.pod 2009-05-11 21:23:47 UTC (rev 6214)
@@ -517,9 +517,6 @@
so no additional SQL statements are executed. You now have a much more
efficient query.
-Note that as of L<DBIx::Class> 0.05999_01, C<prefetch> I<can> be used with
-C<has_many> relationships.
-
Also note that C<prefetch> should only be used when you know you will
definitely use data from a related table. Pre-fetching related tables when you
only need columns from the main table will make performance worse!
@@ -637,7 +634,7 @@
=head2 Multi-step prefetch
-From 0.04999_05 onwards, C<prefetch> can be nested more than one relationship
+C<prefetch> can be nested more than one relationship
deep using the same syntax as a multi-step join:
my $rs = $schema->resultset('Tag')->search(
@@ -677,8 +674,7 @@
AKA getting last_insert_id
-If you are using PK::Auto (which is a core component as of 0.07), this is
-straightforward:
+Thanks to the core component PK::Auto, this is straightforward:
my $foo = $rs->create(\%blah);
# do more stuff
Modified: DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Manual/FAQ.pod
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Manual/FAQ.pod 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Manual/FAQ.pod 2009-05-11 21:23:47 UTC (rev 6214)
@@ -552,3 +552,23 @@
See L<DBIx::Class::Manual::Cookbook/Stringification>
=back
+
+=head2 Troubleshooting
+
+=over 4
+
+=item Help, I can't connect to postgresql!
+
+If you get an error such as:
+
+ DBI connect('dbname=dbic','user',...) failed: could not connect to server:
+ No such file or directory Is the server running locally and accepting
+ connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
+
+Likely you have/had two copies of postgresql installed simultaneously, the
+second one will use a default port of 5433, while L<DBD::Pg> is compiled with a
+default port of 5432.
+
+You can chance the port setting in C<postgresql.conf>.
+
+=back
Modified: DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Relationship/Base.pm
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Relationship/Base.pm 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Relationship/Base.pm 2009-05-11 21:23:47 UTC (rev 6214)
@@ -470,7 +470,7 @@
=over 4
-=item Arguments: (\@hashrefs | \@objs)
+=item Arguments: (\@hashrefs | \@objs), $link_vals?
=back
@@ -481,6 +481,10 @@
$actor->set_roles(\@roles);
# Replaces all of $actor's previous roles with the two named
+ $actor->set_roles(\@roles, { salary => 15_000_000 });
+ # Sets a column in the link table for all roles
+
+
Replace all the related objects with the given reference to a list of
objects. This does a C<delete> B<on the link table resultset> to remove the
association between the current object and all related objects, then calls
Modified: DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Relationship/ManyToMany.pm
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Relationship/ManyToMany.pm 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Relationship/ManyToMany.pm 2009-05-11 21:23:47 UTC (rev 6214)
@@ -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
@@ -103,7 +108,7 @@
);
my @to_set = (ref($_[0]) eq 'ARRAY' ? @{ $_[0] } : @_);
$self->search_related($rel, {})->delete;
- $self->$add_meth($_) for (@to_set);
+ $self->$add_meth($_, ref($_[1]) ? $_[1] : {}) for (@to_set);
};
my $remove_meth_name = join '::', $class, $remove_meth;
Modified: DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/ResultSet.pm
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/ResultSet.pm 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/ResultSet.pm 2009-05-11 21:23:47 UTC (rev 6214)
@@ -796,19 +796,16 @@
if (ref $query eq 'ARRAY') {
foreach my $subquery (@$query) {
next unless ref $subquery; # -or
-# warn "ARRAY: " . Dumper $subquery;
$collapsed = $self->_collapse_query($subquery, $collapsed);
}
}
elsif (ref $query eq 'HASH') {
if (keys %$query and (keys %$query)[0] eq '-and') {
foreach my $subquery (@{$query->{-and}}) {
-# warn "HASH: " . Dumper $subquery;
$collapsed = $self->_collapse_query($subquery, $collapsed);
}
}
else {
-# warn "LEAF: " . Dumper $query;
foreach my $col (keys %$query) {
my $value = $query->{$col};
$collapsed->{$col}{$value}++;
@@ -1743,19 +1740,16 @@
if (ref $cond eq 'ARRAY') {
foreach my $subcond (@$cond) {
next unless ref $subcond; # -or
-# warn "ARRAY: " . Dumper $subcond;
$collapsed = $self->_collapse_cond($subcond, $collapsed);
}
}
elsif (ref $cond eq 'HASH') {
if (keys %$cond and (keys %$cond)[0] eq '-and') {
foreach my $subcond (@{$cond->{-and}}) {
-# warn "HASH: " . Dumper $subcond;
$collapsed = $self->_collapse_cond($subcond, $collapsed);
}
}
else {
-# warn "LEAF: " . Dumper $cond;
foreach my $col (keys %$cond) {
my $value = $cond->{$col};
$collapsed->{$col} = $value;
Modified: DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/ResultSource.pm
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/ResultSource.pm 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/ResultSource.pm 2009-05-11 21:23:47 UTC (rev 6214)
@@ -1110,7 +1110,6 @@
$self->throw_exception("No idea how to resolve join reftype ".ref $join);
} else {
my $count = ++$seen->{$join};
- #use Data::Dumper; warn Dumper($seen);
my $as = ($count > 1 ? "${join}_${count}" : $join);
my $rel_info = $self->relationship_info($join);
$self->throw_exception("No such relationship ${join}") unless $rel_info;
@@ -1287,8 +1286,6 @@
sub resolve_prefetch {
my ($self, $pre, $alias, $seen, $order, $collapse) = @_;
$seen ||= {};
- #$alias ||= $self->name;
- #warn $alias, Dumper $pre;
if( ref $pre eq 'ARRAY' ) {
return
map { $self->resolve_prefetch( $_, $alias, $seen, $order, $collapse ) }
@@ -1301,7 +1298,6 @@
$self->related_source($_)->resolve_prefetch(
$pre->{$_}, "${alias}.$_", $seen, $order, $collapse)
} keys %$pre;
- #die Dumper \@ret;
return @ret;
}
elsif( ref $pre ) {
@@ -1354,8 +1350,6 @@
return map { [ "${as}.$_", "${as_prefix}${pre}.$_", ] }
$rel_source->columns;
- #warn $alias, Dumper (\@ret);
- #return @ret;
}
}
Modified: DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/ResultSourceHandle.pm
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/ResultSourceHandle.pm 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/ResultSourceHandle.pm 2009-05-11 21:23:47 UTC (rev 6214)
@@ -87,7 +87,7 @@
Thaws frozen handle. Resets the internal schema reference to the package
variable C<$thaw_schema>. The recomened way of setting this is to use
-C<$schema->thaw($ice)> which handles this for you.
+C<< $schema->thaw($ice) >> which handles this for you.
=cut
Modified: DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Row.pm
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Row.pm 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Row.pm 2009-05-11 21:23:47 UTC (rev 6214)
@@ -347,7 +347,6 @@
$self->throw_exception( "Can't get last insert id" )
unless (@ids == @auto_pri);
$self->store_column($auto_pri[$_] => $ids[$_]) for 0 .. $#ids;
-#use Data::Dumper; warn Dumper($self);
}
@@ -881,10 +880,10 @@
object. If a hashref of replacement data is supplied, these will take
precedence over data in the original.
-If the row has related objects in a
-L<DBIx::Class::Relationship/has_many> then those objects may be copied
-too depending on the L<cascade_copy|DBIx::Class::Relationship>
-relationship attribute.
+Relationships will be followed by the copy procedure B<only> if the
+relationship specifes a true value for its
+L<cascade_copy|DBIx::Class::Relationship::Base> attribute. C<cascade_copy>
+is set by default on C<has_many> relationships and unset on all others.
=cut
Modified: DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Schema/Versioned.pm
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Schema/Versioned.pm 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Schema/Versioned.pm 2009-05-11 21:23:47 UTC (rev 6214)
@@ -182,7 +182,6 @@
use warnings;
use base 'DBIx::Class';
use POSIX 'strftime';
-use Data::Dumper;
__PACKAGE__->mk_classdata('_filedata');
__PACKAGE__->mk_classdata('upgrade_directory');
Modified: DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Storage/DBI/Cursor.pm
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Storage/DBI/Cursor.pm 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Storage/DBI/Cursor.pm 2009-05-11 21:23:47 UTC (rev 6214)
@@ -36,8 +36,8 @@
sub new {
my ($class, $storage, $args, $attrs) = @_;
- #use Data::Dumper; warn Dumper(@_);
$class = ref $class if ref $class;
+
my $new = {
storage => $storage,
args => $args,
Modified: DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Storage/DBI.pm 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Storage/DBI.pm 2009-05-11 21:23:47 UTC (rev 6214)
@@ -63,8 +63,6 @@
sub _strip_outer_paren {
my ($self, $arg) = @_;
-use Data::Dumper;
-
return $self->_SWITCH_refkind ($arg, {
ARRAYREFREF => sub {
$$arg->[0] = __strip_outer_paren ($$arg->[0]);
@@ -1393,14 +1391,8 @@
# @bind = map { ref $_ ? ''.$_ : $_ } @bind; # stringify args
## This must be an arrayref, else nothing works!
-
my $tuple_status = [];
-
- ##use Data::Dumper;
- ##print STDERR Dumper( $data, $sql, [@bind] );
- my $time = time();
-
## Get the bind_attributes, if any exist
my $bind_attributes = $self->source_bind_attributes($source);
Modified: DBIx-Class/0.08/branches/count_distinct/lib/SQL/Translator/Parser/DBIx/Class.pm
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/lib/SQL/Translator/Parser/DBIx/Class.pm 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/lib/SQL/Translator/Parser/DBIx/Class.pm 2009-05-11 21:23:47 UTC (rev 6214)
@@ -13,7 +13,6 @@
$DEBUG = 0 unless defined $DEBUG;
use Exporter;
-use Data::Dumper;
use SQL::Translator::Utils qw(debug normalize_name);
use base qw(Exporter);
Modified: DBIx-Class/0.08/branches/count_distinct/lib/SQL/Translator/Producer/DBIx/Class/File.pm
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/lib/SQL/Translator/Producer/DBIx/Class/File.pm 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/lib/SQL/Translator/Producer/DBIx/Class/File.pm 2009-05-11 21:23:47 UTC (rev 6214)
@@ -25,6 +25,7 @@
use SQL::Translator::Schema::Constants;
use SQL::Translator::Utils qw(header_comment);
+use Data::Dumper ();
## Skip all column type translation, as we want to use whatever the parser got.
Modified: DBIx-Class/0.08/branches/count_distinct/t/04dont_break_c3.t
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/t/04dont_break_c3.t 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/t/04dont_break_c3.t 2009-05-11 21:23:47 UTC (rev 6214)
@@ -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/count_distinct/t/103many_to_many_warning.t
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/t/103many_to_many_warning.t 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/t/103many_to_many_warning.t 2009-05-11 21:23:47 UTC (rev 6214)
@@ -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/count_distinct/t/39load_namespaces_1.t
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/t/39load_namespaces_1.t 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/t/39load_namespaces_1.t 2009-05-11 21:23:47 UTC (rev 6214)
@@ -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/count_distinct/t/39load_namespaces_2.t
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/t/39load_namespaces_2.t 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/t/39load_namespaces_2.t 2009-05-11 21:23:47 UTC (rev 6214)
@@ -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/count_distinct/t/39load_namespaces_3.t
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/t/39load_namespaces_3.t 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/t/39load_namespaces_3.t 2009-05-11 21:23:47 UTC (rev 6214)
@@ -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/count_distinct/t/39load_namespaces_4.t
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/t/39load_namespaces_4.t 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/t/39load_namespaces_4.t 2009-05-11 21:23:47 UTC (rev 6214)
@@ -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/count_distinct/t/39load_namespaces_rt41083.t
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/t/39load_namespaces_rt41083.t 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/t/39load_namespaces_rt41083.t 2009-05-11 21:23:47 UTC (rev 6214)
@@ -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/count_distinct/t/41orrible.t
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/t/41orrible.t 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/t/41orrible.t 2009-05-11 21:23:47 UTC (rev 6214)
@@ -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/count_distinct/t/42toplimit.t
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/t/42toplimit.t 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/t/42toplimit.t 2009-05-11 21:23:47 UTC (rev 6214)
@@ -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/count_distinct/t/66relationship.t
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/t/66relationship.t 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/t/66relationship.t 2009-05-11 21:23:47 UTC (rev 6214)
@@ -8,7 +8,7 @@
my $schema = DBICTest->init_schema();
-plan tests => 74;
+plan tests => 78;
# has_a test
my $cd = $schema->resultset("CD")->find(4);
@@ -189,6 +189,14 @@
is( $prod_rs->first->name, 'Matt S Trout',
'many_to_many add_to_$rel($obj) ok' );
$cd->remove_from_producers($prod);
+$cd->add_to_producers($prod, {attribute => 1});
+is( $prod_rs->count(), 1, 'many_to_many add_to_$rel($obj, $link_vals) count ok' );
+is( $cd->cd_to_producer->first->attribute, 1, 'many_to_many $link_vals ok');
+$cd->remove_from_producers($prod);
+$cd->set_producers([$prod], {attribute => 2});
+is( $prod_rs->count(), 1, 'many_to_many set_$rel($obj, $link_vals) count ok' );
+is( $cd->cd_to_producer->first->attribute, 2, 'many_to_many $link_vals ok');
+$cd->remove_from_producers($prod);
is( $schema->resultset('Producer')->find(1)->name, 'Matt S Trout',
"producer object exists after remove of link" );
is( $prod_rs->count, 0, 'many_to_many remove_from_$rel($obj) ok' );
@@ -234,6 +242,7 @@
is( $twokey->fourkeys_to_twokeys->count, 0,
'twokey has no links to fourkey' );
+
my $undef_artist_cd = $schema->resultset("CD")->new_result({ 'title' => 'badgers', 'year' => 2007 });
is($undef_artist_cd->has_column_loaded('artist'), '', 'FK not loaded');
is($undef_artist_cd->search_related('artist')->count, 0, '0=1 search when FK does not exist and object not yet in db');
Modified: DBIx-Class/0.08/branches/count_distinct/t/73oracle_inflate.t
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/t/73oracle_inflate.t 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/t/73oracle_inflate.t 2009-05-11 21:23:47 UTC (rev 6214)
@@ -23,6 +23,7 @@
# DateTime::Format::Oracle needs this set
$ENV{NLS_DATE_FORMAT} = 'DD-MON-YY';
+$ENV{NLS_LANG} = 'AMERICAN_AMERICA.WE8ISO8859P1';
my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
Modified: DBIx-Class/0.08/branches/count_distinct/t/94versioning.t
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/t/94versioning.t 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/t/94versioning.t 2009-05-11 21:23:47 UTC (rev 6214)
@@ -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 });
Deleted: DBIx-Class/0.08/branches/count_distinct/t/99rh_perl_perf_bug.t
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/t/99rh_perl_perf_bug.t 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/t/99rh_perl_perf_bug.t 2009-05-11 21:23:47 UTC (rev 6214)
@@ -1,121 +0,0 @@
-#!/usr/bin/perl
-use strict;
-use warnings;
-use Test::More;
-use lib qw(t/lib);
-
-# This is a rather unusual test.
-# It does not test any aspect of DBIx::Class, but instead tests the
-# perl installation this is being run under to see if it is:-
-# 1. Potentially affected by a RH perl build bug
-# 2. If so we do a performance test for the effect of
-# that bug.
-#
-# You can skip these tests by setting the DBIC_NO_WARN_BAD_PERL env
-# variable
-#
-# If these tests fail then please read the section titled
-# Perl Performance Issues on Red Hat Systems in
-# L<DBIx::Class::Manual::Troubleshooting>
-
-plan skip_all =>
- 'Skipping RH perl performance bug tests as DBIC_NO_WARN_BAD_PERL set'
- if ( $ENV{DBIC_NO_WARN_BAD_PERL} );
-
-plan skip_all => 'Skipping as AUTOMATED_TESTING is set'
- if ( $ENV{AUTOMATED_TESTING} );
-
-eval "use Benchmark ':all'";
-plan skip_all => 'needs Benchmark for testing' if $@;
-
-plan tests => 3;
-
-ok( 1, 'Dummy - prevents next test timing out' );
-
-# we do a benchmark test filling an array with blessed/overloaded references,
-# against an array filled with array refs.
-# On a sane system the ratio between these operation sets is 1 - 1.5,
-# whereas a bugged system gives a ratio of around 8
-# we therefore consider there to be a problem if the ratio is >= 2
-
-my $results = timethese(
- -1, # run for 1 CPU second each
- {
- no_bless => sub {
- my %h;
- for ( my $i = 0 ; $i < 10000 ; $i++ ) {
- $h{$i} = [];
- }
- },
- bless_overload => sub {
- use overload q(<) => sub { };
- my %h;
- for ( my $i = 0 ; $i < 10000 ; $i++ ) {
- $h{$i} = bless [] => 'main';
- }
- },
- },
-);
-
-my $ratio = $results->{no_bless}->iters / $results->{bless_overload}->iters;
-
-ok( ( $ratio < 2 ), 'Overload/bless performance acceptable' )
- || diag(
- "\n",
- "This perl has a substantial slow down when handling large numbers\n",
- "of blessed/overloaded objects. This can severely adversely affect\n",
- "the performance of DBIx::Class programs. Please read the section\n",
- "in the Troubleshooting POD documentation entitled\n",
- "'Perl Performance Issues on Red Hat Systems'\n",
- "As this is an extremely serious condition, the only way to skip\n",
- "over this test is to --force the installation, or to edit the test\n",
- "file " . __FILE__ . "\n",
- );
-
-# We will only check for the difference in bless handling (whether the
-# bless applies to the reference or the referent) if we have seen a
-# performance issue...
-
-SKIP: {
- skip "Not checking for bless handling as performance is OK", 1
- if ( $ratio < 2 );
-
- {
- package # don't want this in PAUSE
- TestRHBug;
- use overload bool => sub { 0 }
- }
-
- sub _has_bug_34925 {
- my %thing;
- my $r1 = \%thing;
- my $r2 = \%thing;
- bless $r1 => 'TestRHBug';
- return !!$r2;
- }
-
- sub _possibly_has_bad_overload_performance {
- return $] < 5.008009 && !_has_bug_34925();
- }
-
- # If this next one fails then you almost certainly have a RH derived
- # perl with the performance bug
- # if this test fails, look at the section titled
- # "Perl Performance Issues on Red Hat Systems" in
- # L<DBIx::Class::Manual::Troubleshooting>
- # Basically you may suffer severe performance issues when running
- # DBIx::Class (and many other) modules. Look at getting a fixed
- # version of the perl interpreter for your system.
- #
- ok( !_possibly_has_bad_overload_performance(),
- 'Checking whether bless applies to reference not object' )
- || diag(
- "\n",
- "This perl is probably derived from a buggy Red Hat perl build\n",
- "Please read the section in the Troubleshooting POD documentation\n",
- "entitled 'Perl Performance Issues on Red Hat Systems'\n",
- "As this is an extremely serious condition, the only way to skip\n",
- "over this test is to --force the installation, or to edit the test\n",
- "file " . __FILE__ . "\n",
- );
-}
Added: DBIx-Class/0.08/branches/count_distinct/t/lib/DBICTest/AuthorCheck.pm
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/t/lib/DBICTest/AuthorCheck.pm (rev 0)
+++ DBIx-Class/0.08/branches/count_distinct/t/lib/DBICTest/AuthorCheck.pm 2009-05-11 21:23:47 UTC (rev 6214)
@@ -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/count_distinct/t/lib/DBICTest/Schema/CD_to_Producer.pm
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/t/lib/DBICTest/Schema/CD_to_Producer.pm 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/t/lib/DBICTest/Schema/CD_to_Producer.pm 2009-05-11 21:23:47 UTC (rev 6214)
@@ -7,6 +7,7 @@
__PACKAGE__->add_columns(
cd => { data_type => 'integer' },
producer => { data_type => 'integer' },
+ attribute => { data_type => 'integer', is_nullable => 1 },
);
__PACKAGE__->set_primary_key(qw/cd producer/);
Modified: DBIx-Class/0.08/branches/count_distinct/t/lib/DBICTest.pm
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/t/lib/DBICTest.pm 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/t/lib/DBICTest.pm 2009-05-11 21:23:47 UTC (rev 6214)
@@ -3,6 +3,7 @@
use strict;
use warnings;
+use DBICTest::AuthorCheck;
use DBICTest::Schema;
=head1 NAME
Property changes on: DBIx-Class/0.08/branches/count_distinct/t/lib/DBICTest.pm
___________________________________________________________________
Name: svn:executable
- *
Modified: DBIx-Class/0.08/branches/count_distinct/t/lib/sqlite.sql
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/t/lib/sqlite.sql 2009-05-11 21:21:11 UTC (rev 6213)
+++ DBIx-Class/0.08/branches/count_distinct/t/lib/sqlite.sql 2009-05-11 21:23:47 UTC (rev 6214)
@@ -108,6 +108,7 @@
CREATE TABLE cd_to_producer (
cd integer NOT NULL,
producer integer NOT NULL,
+ attribute integer,
PRIMARY KEY (cd, producer)
);
Copied: DBIx-Class/0.08/branches/count_distinct/t/zzzzzzz_perl_perf_bug.t (from rev 5756, DBIx-Class/0.08/branches/count_distinct/t/99rh_perl_perf_bug.t)
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/t/zzzzzzz_perl_perf_bug.t (rev 0)
+++ DBIx-Class/0.08/branches/count_distinct/t/zzzzzzz_perl_perf_bug.t 2009-05-11 21:23:47 UTC (rev 6214)
@@ -0,0 +1,121 @@
+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
+# perl installation this is being run under to see if it is:-
+# 1. Potentially affected by a RH perl build bug
+# 2. If so we do a performance test for the effect of
+# that bug.
+#
+# You can skip these tests by setting the DBIC_NO_WARN_BAD_PERL env
+# variable
+#
+# If these tests fail then please read the section titled
+# Perl Performance Issues on Red Hat Systems in
+# L<DBIx::Class::Manual::Troubleshooting>
+
+plan skip_all =>
+ 'Skipping RH perl performance bug tests as DBIC_NO_WARN_BAD_PERL set'
+ if ( $ENV{DBIC_NO_WARN_BAD_PERL} );
+
+plan skip_all => 'Skipping as AUTOMATED_TESTING is set'
+ if ( $ENV{AUTOMATED_TESTING} );
+
+eval "use Benchmark ':all'";
+plan skip_all => 'needs Benchmark for testing' if $@;
+
+plan tests => 3;
+
+ok( 1, 'Dummy - prevents next test timing out' );
+
+# we do a benchmark test filling an array with blessed/overloaded references,
+# against an array filled with array refs.
+# On a sane system the ratio between these operation sets is 1 - 1.5,
+# whereas a bugged system gives a ratio of around 8
+# we therefore consider there to be a problem if the ratio is >= 2
+
+my $results = timethese(
+ -1, # run for 1 CPU second each
+ {
+ no_bless => sub {
+ my %h;
+ for ( my $i = 0 ; $i < 10000 ; $i++ ) {
+ $h{$i} = [];
+ }
+ },
+ bless_overload => sub {
+ use overload q(<) => sub { };
+ my %h;
+ for ( my $i = 0 ; $i < 10000 ; $i++ ) {
+ $h{$i} = bless [] => 'main';
+ }
+ },
+ },
+);
+
+my $ratio = $results->{no_bless}->iters / $results->{bless_overload}->iters;
+
+ok( ( $ratio < 2 ), 'Overload/bless performance acceptable' )
+ || diag(
+ "\n",
+ "This perl has a substantial slow down when handling large numbers\n",
+ "of blessed/overloaded objects. This can severely adversely affect\n",
+ "the performance of DBIx::Class programs. Please read the section\n",
+ "in the Troubleshooting POD documentation entitled\n",
+ "'Perl Performance Issues on Red Hat Systems'\n",
+ "As this is an extremely serious condition, the only way to skip\n",
+ "over this test is to --force the installation, or to edit the test\n",
+ "file " . __FILE__ . "\n",
+ );
+
+# We will only check for the difference in bless handling (whether the
+# bless applies to the reference or the referent) if we have seen a
+# performance issue...
+
+SKIP: {
+ skip "Not checking for bless handling as performance is OK", 1
+ if ( $ratio < 2 );
+
+ {
+ package # don't want this in PAUSE
+ TestRHBug;
+ use overload bool => sub { 0 }
+ }
+
+ sub _has_bug_34925 {
+ my %thing;
+ my $r1 = \%thing;
+ my $r2 = \%thing;
+ bless $r1 => 'TestRHBug';
+ return !!$r2;
+ }
+
+ sub _possibly_has_bad_overload_performance {
+ return $] < 5.008009 && !_has_bug_34925();
+ }
+
+ # If this next one fails then you almost certainly have a RH derived
+ # perl with the performance bug
+ # if this test fails, look at the section titled
+ # "Perl Performance Issues on Red Hat Systems" in
+ # L<DBIx::Class::Manual::Troubleshooting>
+ # Basically you may suffer severe performance issues when running
+ # DBIx::Class (and many other) modules. Look at getting a fixed
+ # version of the perl interpreter for your system.
+ #
+ ok( !_possibly_has_bad_overload_performance(),
+ 'Checking whether bless applies to reference not object' )
+ || diag(
+ "\n",
+ "This perl is probably derived from a buggy Red Hat perl build\n",
+ "Please read the section in the Troubleshooting POD documentation\n",
+ "entitled 'Perl Performance Issues on Red Hat Systems'\n",
+ "As this is an extremely serious condition, the only way to skip\n",
+ "over this test is to --force the installation, or to edit the test\n",
+ "file " . __FILE__ . "\n",
+ );
+}
More information about the Bast-commits
mailing list