[Dbix-class] dbix + perl5.18
Peter Rabbitson
rabbit+dbic at rabbit.us
Wed Jun 12 14:17:25 GMT 2013
On Wed, Jun 12, 2013 at 03:42:20PM +0200, Bernhard Bauch wrote:
> dear dbix-folks,
>
> ...
>
> i figured out where the problem is!
>
> since perl 5.18 >>> hash-ramdomizatiomn is used see:
> https://metacpan.org/module/RJBS/perl-5.18.0/pod/perldelta.pod#Hash-randomization
>
> in DBIx::Class::Schema.pm line 232:
> my %results = $class->_map_namespaces(@$result_namespace);
> an ordered list of result classes is stored in an hash ....
>
This can't be true - _map_namespaces returns a list, without any
kind of order (it's Filesystem order). Even if it did - the order
would not be preserved on older perls either, after the hash
assignment.
> later in line242:
> for my $res (values %results) {
> $class->ensure_class_loaded($res);
> this hash is used
> the error ist, that "values" return a randomly sorted list now ... the correct order coming from
> $class->_map_namespaces(@$result_namespace);
> is neglected.
>
>
> this was my workaround-fix ....
> ---------------------------
> diff Schema.pm_fix Schema.pm
> 235,241d234
> < # correct order !!!
> < my @result_classes;
> < foreach my $class ( $class->_map_namespaces(@$result_namespace) ){
> < push (@result_classes, $class) if $class =~ /Schema::Result/;
> < }
> <
> <
> 249,250c242
> < # for my $res (values %results) {
> < for my $res ( @result_classes ) {
> ---
> > for my $res (values %results) {
> ---------------------------
This can't be the correct fix due to reasons described above. Something
else is happening that prevents a *specific class* requiring its
far-relationship side.
Please provide several definitions of the adected classes (both the ones
that throw an exception, and the ones whose load fails).
>
> maybe this should be fixed in upcoming DBIx::Class releases ?
It should definitely be fixed, but first the real problem must be
identified ;)
Cheers
More information about the DBIx-Class
mailing list