requires 'Data::Dumper::Concise' => '1.200';
requires 'Scope::Guard' => 0;
requires 'List::MoreUtils' => 0;
+requires 'Exporter' => '5.63';
install_script 'script/dbicdump';
use Data::Dumper::Concise;
use Scalar::Util 'looks_like_number';
use File::Slurp 'slurp';
+use DBIx::Class::Schema::Loader::Constants 'BY_CASE_TRANSITION';
require DBIx::Class;
our $VERSION = '0.07000';
sub _make_column_accessor_name {
my ($self, $column_name) = @_;
- return join '_', map lc, split /(?<=[[:lower:]])[\W_]*(?=[[:upper:]])|[\W_]+/, $column_name;
+ return join '_', map lc, split BY_CASE_TRANSITION, $column_name;
}
# Set up metadata (cols, pks, etc)
return join '', map ucfirst, split /\W+/, $inflected;
}
- my @words = map lc, split /(?<=[[:lower:]])[\W_]*(?=[[:upper:]])|[\W_]+/, $table;
+ my @words = map lc, split BY_CASE_TRANSITION, $table;
my $as_phrase = join ' ', @words;
my $inflected = Lingua::EN::Inflect::Phrase::to_S($as_phrase);
--- /dev/null
+package # hide from PAUSE
+ DBIx::Class::Schema::Loader::Constants;
+
+use strict;
+use warnings;
+use Exporter 'import';
+
+our @EXPORT_OK = qw/BY_CASE_TRANSITION/;
+
+use constant BY_CASE_TRANSITION =>
+ qr/(?<=[[:lower:]\d])[\W_]*(?=[[:upper:]])|[\W_]+/;
+
+1;
use Class::C3;
use Carp::Clan qw/^DBIx::Class/;
use Lingua::EN::Inflect::Phrase ();
+use DBIx::Class::Schema::Loader::Constants 'BY_CASE_TRANSITION';
our $VERSION = '0.07000';
sub _normalize_name {
my ($self, $name) = @_;
- my @words = split /(?<=[[:lower:]])[\W_]*(?=[[:upper:]])|[\W_]+/, $name;
+ my @words = split BY_CASE_TRANSITION, $name;
return join '_', map lc, @words;
}