carp_once "compose_connection deprecated as of 0.08000"
unless $INC{"DBIx/Class/CDBICompat.pm"};
- my $base = 'DBIx::Class::ResultSetProxy';
try {
- eval "require ${base};"
+ require DBIx::Class::ResultSetProxy;
}
catch {
$self->throw_exception
- ("No arguments to load_classes and couldn't load ${base} ($_)")
+ ("No arguments to load_classes and couldn't load DBIx::Class::ResultSetProxy ($_)")
};
if ($self eq $target) {
foreach my $source_name ($self->sources) {
my $source = $self->source($source_name);
my $class = $source->result_class;
- $self->inject_base($class, $base);
+ $self->inject_base($class, 'DBIx::Class::ResultSetProxy');
$class->mk_classdata(resultset_instance => $source->resultset);
$class->mk_classdata(class_resolver => $self);
}
return $self;
}
- my $schema = $self->compose_namespace($target, $base);
+ my $schema = $self->compose_namespace($target, 'DBIx::Class::ResultSetProxy');
quote_sub "${target}::schema", '$s', { '$s' => \$schema };
$schema->connection(@info);
sub build_datetime_parser {
my $self = shift;
- my $type = "DateTime::Format::Strptime";
try {
- eval "require ${type}"
+ require DateTime::Format::Strptime;
}
catch {
- $self->throw_exception("Couldn't load ${type}: $_");
+ $self->throw_exception("Couldn't load DateTime::Format::Strptime: $_");
};
- return $type->new( pattern => '%Y-%m-%d %H:%M:%S.%6N' );
+ return DateTime::Format::Strptime->new( pattern => '%Y-%m-%d %H:%M:%S.%6N' );
}
=head2 connect_call_datetime_setup
use SQL::Translator::Utils qw(debug normalize_name);
use DBIx::Class::Carp qw/^SQL::Translator|^DBIx::Class|^Try::Tiny/;
use DBIx::Class::Exception;
+use Class::C3::Componentised;
use Scalar::Util 'blessed';
use Try::Tiny;
use namespace::clean;
DBIx::Class::Exception->throw('No DBIx::Class::Schema') unless ($dbicschema);
if (!ref $dbicschema) {
- eval "require $dbicschema"
- or DBIx::Class::Exception->throw("Can't load $dbicschema: $@");
+ try {
+ Class::C3::Componentised->ensure_class_loaded($dbicschema)
+ } catch {
+ DBIx::Class::Exception->throw("Can't load $dbicschema: $_");
+ }
}
if (