- add hashref form of generate_pod to control which POD is generated
- add hashref form of components to control which components are added to
which classes
- - add original => {} to all type info rewrites
- add common tests for preserve_case option
- - correct handling of CamelCase names with numbers (eg. foo2Bar -> Foo2Bar,
- foo2_bar)
- check rel accessors for method conflicts
- add an option to add extra code to Result classes
use Data::Dumper::Concise;
use Scalar::Util 'looks_like_number';
use File::Slurp 'slurp';
-use DBIx::Class::Schema::Loader::Constants 'BY_CASE_TRANSITION';
+use DBIx::Class::Schema::Loader::Utils 'split_name';
require DBIx::Class;
our $VERSION = '0.07000';
sub _make_column_accessor_name {
my ($self, $column_name) = @_;
- return join '_', map lc, split BY_CASE_TRANSITION, $column_name;
+ return join '_', map lc, split_name $column_name;
}
# Set up metadata (cols, pks, etc)
return join '', map ucfirst, split /\W+/, $inflected;
}
- my @words = map lc, split BY_CASE_TRANSITION, $table;
+ my @words = map lc, split_name $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';
+use DBIx::Class::Schema::Loader::Utils 'split_name';
our $VERSION = '0.07000';
sub _normalize_name {
my ($self, $name) = @_;
- my @words = split BY_CASE_TRANSITION, $name;
+ my @words = split_name $name;
return join '_', map lc, @words;
}
--- /dev/null
+package # hide from PAUSE
+ DBIx::Class::Schema::Loader::Utils;
+
+use strict;
+use warnings;
+use Exporter 'import';
+
+our @EXPORT_OK = qw/split_name/;
+
+use constant BY_CASE_TRANSITION =>
+ qr/(?<=[[:lower:]\d])[\W_]*(?=[[:upper:]])|[\W_]+/;
+
+use constant BY_NON_ALPHANUM =>
+ qr/[\W_]+/;
+
+sub split_name($) {
+ my $name = shift;
+
+ split $name =~ /[[:upper:]]/ && $name =~ /[[:lower:]]/ ? BY_CASE_TRANSITION : BY_NON_ALPHANUM, $name;
+}
+
+1;
+# vim:et sts=4 sw=4 tw=0:
'might_have does not have is_deferrable');
# find on multi-col pk
- my $obj5 =
- eval { $rsobj5->find({id1 => 1, iD2 => 1}) } ||
- eval { $rsobj5->find({id1 => 1, id2 => 1}) };
- die $@ if $@;
-
- is( (eval { $obj5->id2 } || eval { $obj5->i_d2 }), 1, "Find on multi-col PK" );
+ if ($conn->_loader->preserve_case) {
+ my $obj5 = $rsobj5->find({id1 => 1, iD2 => 1});
+ is $obj5->i_d2, 1, 'Find on multi-col PK';
+ }
+ else {
+ my $obj5 = $rsobj5->find({id1 => 1, id2 => 1});
+ is $obj5->id2, 1, 'Find on multi-col PK';
+ }
# mulit-col fk def
my $obj6 = $rsobj6->find(1);