use Storable;
use DBIx::Class::ResultSetColumn;
use DBIx::Class::ResultSourceHandle;
-use List::Util ();
use Hash::Merge ();
use Scalar::Util qw/blessed weaken/;
use Try::Tiny;
use Storable qw/nfreeze thaw/;
+
+# not importing first() as it will clash with our own method
+use List::Util ();
+
use namespace::clean;
+
BEGIN {
# De-duplication in _merge_attr() is disabled, but left in for reference
*__HM_DEDUP = sub () { 0 };
}
my $attrs = $self->{attrs};
- $self->throw_exception("Can't create pager for non-paged rs")
- unless $self->{attrs}{page};
+ if (!defined $attrs->{page}) {
+ $self->throw_exception("Can't create pager for non-paged rs");
+ }
+ elsif ($attrs->{page} <= 0) {
+ $self->throw_exception('Invalid page number (page-numbers are 1-based)');
+ }
$attrs->{rows} ||= 10;
# throw away the paging flags and re-run the count (possibly
$_->{as} = [ map { $_ =~ /^\Q$alias.\E(.+)$/ ? $1 : $_ } @{$_->{as}} ];
}
- # FIXME !!!
- # Blatant bugwardness encoded into multiple tests.
- # While columns behaves sensibly, +columns is expected
- # to dump *any* foreign columns into the main object
- # /me vomits
- $selection_pieces->{'+columns'}{as} = [ map
- { (split /\./, $_)[-1] }
- @{$selection_pieces->{'+columns'}{as}}
- ];
-
# merge everything
for (@sel_pairs) {
$attrs->{select} = $self->_merge_attr ($attrs->{select}, $selection_pieces->{$_}{select});