Created
July 5, 2017 15:50
-
-
Save ribasushi/f46e2631af128092f1367d76fae86656 to your computer and use it in GitHub Desktop.
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
# As amply documented at: | |
# | |
# https://github.com/dbsrgits/dbix-class/blob/dc7d89911/lib/DBIx/Class/MethodAttributes.pm#L242-L298 | |
# https://github.com/dbsrgits/dbix-class/blob/dc7d89911/lib/DBIx/Class/ResultSourceProxy.pm#L137-L143 | |
# https://github.com/dbsrgits/dbix-class/blob/dc7d89911/lib/DBIx/Class/ResultSourceProxy.pm#L191-L262 | |
# | |
perl -e ' | |
{ | |
package HowHardCanItBe::Result; | |
use Carp; | |
use base "DBIx::Class::Core"; | |
# people do this all over the place | |
sub add_columns { | |
carp( "add_columns override invoked" ); # you will see this due to the call further down, but no whining about attrs | |
shift->next::method(@_); | |
} | |
# people do this *too*: | |
# https://metacpan.org/source/VANSTYN/RapidApp-1.3001/lib/RapidApp/DBIC/Component/VirtualColumns.pm#L332-360 | |
# https://metacpan.org/source/VANSTYN/RapidApp-1.3001/lib/RapidApp/DBIC/Component/VirtualColumnsExt.pm#L75-80 | |
sub columns { | |
carp( "columns override invoked" ); # you will never see this: neither on old DBIC nor on new | |
shift->next::method(@_); | |
} | |
__PACKAGE__->table("how"); | |
# we call it, yet no warning | |
__PACKAGE__->add_columns("hard"); | |
} | |
{ | |
package HowHardCanItBe::Schema; | |
use base "DBIx::Class::Schema"; | |
__PACKAGE__->register_class( "How" => "HowHardCanItBe::Result" ); | |
} | |
my $rs = HowHardCanItBe::Schema->connect( sub {} )->resultset("How"); | |
$rs->result_source->columns; | |
' | |
# Before ( 0.082840 and earlier ): | |
add_columns override invoked at -e line 13. | |
HowHardCanItBe::Result::add_columns("HowHardCanItBe::Result", "hard") called at -e line 25 | |
# After ( master ): | |
add_columns override invoked at -e line 13. | |
HowHardCanItBe::Result::add_columns("HowHardCanItBe::Result", "hard") called at -e line 25 | |
The override method HowHardCanItBe::Result::columns() has been bypassed at -e line 38 | |
In order to silence this warning you must tag the definition of HowHardCanItBe::Result::columns() with one of the attributes ':DBIC_method_is_bypassable_resultsource_proxy' or ':DBIC_method_is_mandatory_resultsource_proxy' ( see https://is.gd/dbic_rsrcproxy_methodattr for more info ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment