sub with_parameterized_join {
my ($self, $rel, $params) = @_;
+ die "Missing relation name in with_parameterized_join"
+ unless defined $rel;
+ {
+ my $params_ref = ref($params);
+ $params_ref = 'non-reference-value'
+ unless $params_ref;
+ die "Parameters value must be a hash ref, not ${params_ref}"
+ unless $params_ref eq 'HASH';
+ }
$self->search_rs(
{},
{ join => $rel,
->$search
->$fetch_count;
}, qr{__invalid__}, 'unknown relation';
+ like exception {
+ $people->with_parameterized_join(undef, {});
+ }, qr{relation.+name}i, 'missing relation name';
+ like exception {
+ $people->with_parameterized_join(foo => []);
+ }, qr{parameters.+hash.+not.+ARRAY}i, 'invalid parameters';
+ like exception {
+ $people->with_parameterized_join(foo => 23);
+ }, qr{parameters.+hash.+not.+non-reference}i, 'non ref parameters';
};
};