'Class::Accessor::Fast' => 0.22,
'Class::Data::Accessor' => 0.02,
'Class::C3' => 0.11,
+ 'Carp::Clan' => 0,
'DBIx::Class' => 0.06003,
},
recommends => {
-Better error message if no loader_options were set (see ML msg from Daniel McBrearty)
-
support multiple/all schemas, instead of just one
support pk/uk/fk info on views, possibly. May or may not be a sane thing to try to do.
use warnings;
use base qw/DBIx::Class::Schema/;
use base qw/Class::Data::Accessor/;
-use Carp;
+use Carp::Clan qw/^DBIx::Class::Schema::Loader/;
use UNIVERSAL::require;
use Class::C3;
use Scalar::Util qw/ weaken /;
sub clone {
my $self = shift;
+ croak "You failed to specify the required loader_options"
+ if !$self->_loader_args;
+
my $clone = $self->next::method(@_);
$clone->_loader_args($self->_loader_args);
use warnings;
use base qw/Class::Accessor::Fast/;
use Class::C3;
-use Carp;
+use Carp::Clan qw/^DBIx::Class::Schema::Loader/;
use UNIVERSAL::require;
use DBIx::Class::Schema::Loader::RelBuilder;
use Data::Dump qw/ dump /;
foreach (@name_parts) {
$dir .= q{/} . $_;
if(! -d $dir) {
- mkdir($dir) or die "mkdir('$dir') failed: $!";
+ mkdir($dir) or croak "mkdir('$dir') failed: $!";
}
}
}
my $target_dir = $self->dump_directory;
my $schema_class = $self->schema_class;
- die "Must specify target directory for dumping!" if ! $target_dir;
+ croak "Must specify target directory for dumping!" if ! $target_dir;
warn "Dumping manual schema for $schema_class to directory $target_dir ...\n";
if(! -d $target_dir) {
- mkdir($target_dir) or die "mkdir('$target_dir') failed: $!";
+ mkdir($target_dir) or croak "mkdir('$target_dir') failed: $!";
}
my $verstr = $DBIx::Class::Schema::Loader::VERSION;
my $schema_fn = $self->_get_dump_filename($schema_class);
open(my $schema_fh, '>', $schema_fn)
- or die "Cannot open $schema_fn for writing: $!";
+ or croak "Cannot open $schema_fn for writing: $!";
print $schema_fh qq|package $schema_class;\n\n$tagline\n\n|;
print $schema_fh qq|use strict;\nuse warnings;\n\n|;
print $schema_fh qq|use base 'DBIx::Class::Schema';\n\n|;
print $schema_fh qq|__PACKAGE__->load_classes;\n|;
print $schema_fh qq|\n1;\n\n|;
close($schema_fh)
- or die "Cannot close $schema_fn: $!";
+ or croak "Cannot close $schema_fn: $!";
foreach my $src_class (sort keys %{$self->{_dump_storage}}) {
$self->_ensure_dump_subdirs($src_class);
my $src_fn = $self->_get_dump_filename($src_class);
open(my $src_fh, '>', $src_fn)
- or die "Cannot open $src_fn for writing: $!";
+ or croak "Cannot open $src_fn for writing: $!";
print $src_fh qq|package $src_class;\n\n$tagline\n\n|;
print $src_fh qq|use strict;\nuse warnings;\n\n|;
print $src_fh qq|use base 'DBIx::Class';\n\n|;
for @{$self->{_dump_storage}->{$src_class}};
print $src_fh qq|\n1;\n\n|;
close($src_fh)
- or die "Cannot close $src_fn: $!";
+ or croak "Cannot close $src_fn: $!";
}
warn "Schema dump completed.\n";
use warnings;
use base qw/DBIx::Class::Schema::Loader::Base Class::Accessor::Fast/;
use Class::C3;
-use Carp;
+use Carp::Clan qw/^DBIx::Class::Schema::Loader/;
use UNIVERSAL::require;
=head1 NAME
my $subclass = 'DBIx::Class::Schema::Loader::DBI::' . $driver;
$subclass->require;
if($@ && $@ !~ /^Can't locate /) {
- die "Failed to require $subclass: $@";
+ croak "Failed to require $subclass: $@";
}
elsif(!$@) {
bless $self, "DBIx::Class::Schema::Loader::DBI::${driver}";
use strict;
use warnings;
use base 'DBIx::Class::Schema::Loader::DBI';
+use Carp::Clan qw/^DBIx::Class::Schema::Loader/;
use Class::C3;
=head1 NAME
use strict;
use warnings;
use base 'DBIx::Class::Schema::Loader::DBI';
+use Carp::Clan qw/^DBIx::Class::Schema::Loader/;
use Class::C3;
=head1 NAME
use strict;
use warnings;
use base qw/DBIx::Class::Schema::Loader::DBI/;
-use Class::C3;
+use Carp::Clan qw/^DBIx::Class::Schema::Loader/;
use Text::Balanced qw( extract_bracketed );
+use Class::C3;
=head1 NAME
my $rcols;
if($f_cols) {
my @f_cols = map { s/\s*//g; lc $_ } split(/\s*,\s*/,$f_cols);
- die "Mismatched column count in rel for $table => $f_table"
+ croak "Mismatched column count in rel for $table => $f_table"
if @cols != @f_cols;
$rcols = \@f_cols;
}
use strict;
use warnings;
use base 'DBIx::Class::Schema::Loader::DBI';
+ use Carp::Clan qw/^DBIx::Class::Schema::Loader/;
use Class::C3;
sub _table_uniq_info {
=head1 DETAILS
The only required method for new subclasses is C<_table_uniq_info>,
-as I have not to date found any pseudo-standardized or DBD-agnostic
-way for obtaining this information.
+as there is not (yet) any standardized, DBD-agnostic way for obtaining
+this information from DBI.
The base DBI Loader contains generic methods that *should* work for
everything else in theory, although in practice some DBDs need to
use strict;
use warnings;
use base 'DBIx::Class::Schema::Loader::DBI';
+use Carp::Clan qw/^DBIx::Class::Schema::Loader/;
use Class::C3;
=head1 NAME
my $dbh = $self->schema->storage->dbh;
my $table_def_ref = $dbh->selectrow_arrayref("SHOW CREATE TABLE $table")
- or die ("Cannot get table definition for $table");
+ or croak ("Cannot get table definition for $table");
my $table_def = $table_def_ref->[1] || '';
my (@reldata) = ($table_def =~ /CONSTRAINT `.*` FOREIGN KEY \(`(.*)`\) REFERENCES `(.*)` \(`(.*)`\)/ig);
use strict;
use warnings;
-use Carp;
+use Carp::Clan qw/^DBIx::Class::Schema::Loader/;
use Lingua::EN::Inflect ();
use Lingua::EN::Inflect::Number ();