Created
November 5, 2014 15:24
-
-
Save arc/81a06d2842cb5b754942 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for my $source_name (__PACKAGE__->sources) { | |
my $method_name = lc($source_name =~ s/(?<=.)(?=[A-Z])/_/axmsgr); | |
s/(?<![aeiou])y$/ies/axms or s/(?:ss|s|sh|ch|x)\K\z/es/axms or s/\z/s/axms | |
for $method_name; # XXX: perhaps use Lingua::EN::Inflect or similar? | |
my $method = sub { | |
my $rs = shift->resultset($source_name); | |
return @_ ? $rs->search_rs(@_) : $rs; | |
}; | |
no strict 'refs'; | |
*$method_name = $method; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment