-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve $rsrc instance duality on metadata traversal
Make result_source a straight wrapper around result_source_instance. This should fix all the fallout introduced in 0.082800 (4006691), which sadly went undetected all the way until ~7 months after its release. Ultimately this is my fault, as I had an early warning, and even later made a conjecture which spot exactly may blow up in my face (read towards end of 350e8d5) Exploit the fact that result_source_instance until very recently was a toss-up between a CAG 'inherited' and a Class::Data::Inheritable (removed in 5e0eea3) with CAG not really involved in result-instance level calls, and the latter making it downright impractical due to the closure-based approach. Combined with the fact that result_source was a 'simple'-type accessor pointing at the '_result_source' hash-slot allows us (at least seemingly) to switch to a setup where result_source is nothing but a wrapper around a CAG inherited accessor result_source_instance which point to the named slot '_result_source' The changeset is deceptively small, and is kept this way for easier auditing. See next commit for the armada of additional testing to verify the entire stack is in fact still solid.
- Loading branch information
Showing
6 changed files
with
62 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) } | ||
|
|
||
| use strict; | ||
| use warnings; | ||
|
|
||
| use Test::More; | ||
|
|
||
| use DBICTest; | ||
|
|
||
| my $ar = DBICTest->init_schema->resultset("Artist")->find(1); | ||
|
|
||
| ok (! $ar->can("not_yet_there_column"), "No accessor for nonexitentcolumn" ); | ||
|
|
||
| $ar->add_column("not_yet_there_column"); | ||
| ok ($ar->has_column("not_yet_there_column"), "Metadata correct after nonexitentcolumn addition" ); | ||
| ok ($ar->can("not_yet_there_column"), "Accessor generated for nonexitentcolumn" ); | ||
|
|
||
| $ar->not_yet_there_column('I EXIST \o/'); | ||
|
|
||
| is { $ar->get_columns }->{not_yet_there_column}, 'I EXIST \o/', "Metadata propagates to mutli-column methods"; | ||
|
|
||
| done_testing; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) } | ||
|
|
||
| use strict; | ||
| use warnings; | ||
| no warnings 'qw'; | ||
|
|
||
| use Test::More; | ||
|
|
||
| use DBICTest; | ||
|
|
||
| my $schema = DBICTest->init_schema; | ||
| my $rsrc = $schema->source("Artist"); | ||
|
|
||
| is( (eval($_)||die $@), $rsrc, "Same source object after $_" ) for qw( | ||
| $rsrc->resultset->result_source, | ||
| $rsrc->resultset->next->result_source, | ||
| $rsrc->resultset->next->result_source_instance, | ||
| $schema->resultset("Artist")->result_source, | ||
| $schema->resultset("Artist")->next->result_source, | ||
| $schema->resultset("Artist")->next->result_source_instance, | ||
| ); | ||
|
|
||
| done_testing; |