our $VERSION = 0.001000;
sub register_source {
- my $self = shift;
+ my $self = shift;
my $moniker = $_[0];
- my $next = $self->next::method(@_);
+ my $next = $self->next::method(@_);
+ my $schema = ref($self) || $self;
+
+ my $accessor_name =
+ exists $self->resultset_accessor_map->{$moniker}
+ ? $self->resultset_accessor_map->{$moniker}
+ : $self->resultset_accessor_name($moniker);
- my $schema = ref($self) || $self;
- my $accessor_name = exists $self->resultset_accessor_map->{$moniker}
- ? $self->resultset_accessor_map->{$moniker}
- : $self->resultset_accessor_name($moniker);
if ($schema->can($accessor_name)) {
$self->throw_exception(
"Can't create ResultSet accessor '$accessor_name'. " .
"Schema method with the same name already exists. " .
- "Try overloading the name in resultset_accessor_map."
+ "Try overloading the name via resultset_accessor_map."
);
}
}
sub resultset_accessor_map {
- return {};
+ {}
}
sub resultset_accessor_name {
}
sub pluralize_resultset_accessor_name {
- my $self = shift;
- my $original = shift or return;
+ my ($self, $original) = @_;
- return join q{_}, split /\s+/,
- Lingua::EN::Inflect::Phrase::to_PL(join q{ }, split /_/, $original);
+ return join ' ', split /\s+/,
+ Lingua::EN::Inflect::Phrase::to_PL(join ' ', split /_/, $original);
}
1; # eof