use strict;
use warnings;
-use base qw/DBIx::Class::Cursor/;
+use base 'DBIx::Class::Cursor';
use Try::Tiny;
-use Scalar::Util qw/refaddr weaken/;
+use Scalar::Util qw(refaddr weaken);
+use List::Util 'shuffle';
use namespace::clean;
__PACKAGE__->mk_group_accessors('simple' =>
attrs => $attrs,
}, ref $class || $class;
- weaken( $cursor_registry{ refaddr($self) } = $self )
- if DBIx::Class::_ENV_::HAS_ITHREADS;
+ if (DBIx::Class::_ENV_::HAS_ITHREADS) {
+
+ # quick "garbage collection" pass - prevents the registry
+ # from slowly growing with a bunch of undef-valued keys
+ defined $cursor_registry{$_} or delete $cursor_registry{$_}
+ for keys %cursor_registry;
+
+ weaken( $cursor_registry{ refaddr($self) } = $self )
+ }
return $self;
}
(undef, $sth) = $self->storage->_select( @{$self->{args}} );
- return @{$sth->fetchall_arrayref};
+ return (
+ DBIx::Class::_ENV_::SHUFFLE_UNORDERED_RESULTSETS
+ and
+ ! $self->{attrs}{order_by}
+ )
+ ? shuffle @{$sth->fetchall_arrayref}
+ : @{$sth->fetchall_arrayref}
+ ;
}
sub sth {
);
}
+=head1 FURTHER QUESTIONS?
+
+Check the list of L<additional DBIC resources|DBIx::Class/GETTING HELP/SUPPORT>.
+
+=head1 COPYRIGHT AND LICENSE
+
+This module is free software L<copyright|DBIx::Class/COPYRIGHT AND LICENSE>
+by the L<DBIx::Class (DBIC) authors|DBIx::Class/AUTHORS>. You can
+redistribute it and/or modify it under the same terms as the
+L<DBIx::Class library|DBIx::Class/COPYRIGHT AND LICENSE>.
+
+=cut
+
1;