[Bast-commits] r8356 - DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class

goraxe at dev.catalyst.perl.org goraxe at dev.catalyst.perl.org
Sun Jan 17 22:35:03 GMT 2010


Author: goraxe
Date: 2010-01-17 22:35:03 +0000 (Sun, 17 Jan 2010)
New Revision: 8356

Modified:
   DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Admin.pm
Log:
change warns/dies -> carp/throw_exception

Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Admin.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Admin.pm	2010-01-17 22:33:10 UTC (rev 8355)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Admin.pm	2010-01-17 22:35:03 UTC (rev 8356)
@@ -23,7 +23,10 @@
 use MooseX::Types::Path::Class qw(Dir File);
 use Try::Tiny;
 
+use Carp::Clan qw/^DBIx::Class/;
+
 use parent 'Class::C3::Componentised';
+use parent 'DBIx::Class::Schema';
 
 use JSON::Any;
 
@@ -84,25 +87,6 @@
 
 =head1 Attributes
 
-=head2 lib
-
-add a library search path
-
-=cut
-
-has lib => (
-  is    => 'ro',
-  isa    => Dir,
-  coerce  => 1,
-  trigger => \&_set_inc,
-);
-
-sub _set_inc {
-  my ($self, $lib) = @_;
-  push @INC, $lib->stringify;
-}
-
-
 =head2 schema_class
 
 the class of the schema to load
@@ -250,7 +234,7 @@
 
 sub _build_config {
   my ($self) = @_;
-  try { require Config::Any } catch { die "Config::Any is required to parse the config file"; };
+  try { require Config::Any } catch { $self->throw_exception( "Config::Any is required to parse the config file"); };
 
   my $cfg = Config::Any->load_files ( {files => [$self->config_file], use_ext =>1, flatten_to_hash=>1});
 
@@ -376,7 +360,7 @@
   my $schema = $self->schema();
   if (!$schema->get_db_version()) {
     # schema is unversioned
-    die "could not determin current schema version, please either install or deploy";
+    $self->throw_exception ("could not determin current schema version, please either install or deploy");
   } else {
     my $ret = $schema->upgrade();
     return $ret;
@@ -411,14 +395,13 @@
     print "retun is $ret\n";
   }
   elsif ($schema->get_db_version() and $self->force ) {
-    warn "Forcing install may not be a good idea";
+    carp "Forcing install may not be a good idea";
     if($self->_confirm() ) {
-      # FIXME private api
       $self->schema->_set_db_version({ version => $version});
     }
   }
   else {
-    die "schema already has a version not installing, try upgrade instead";
+    $self->throw_exception ("schema already has a version not installing, try upgrade instead");
   }
 
 }
@@ -443,18 +426,12 @@
   if (!$schema->get_db_version() ) {
     # schema is unversioned
     $schema->deploy( $args, $self->sql_dir)
-      or die "could not deploy schema";
+      or $self->throw_exception ("could not deploy schema");
   } else {
-    die "there already is a database with a version here, try upgrade instead";
+    $self->throw_exception("there already is a database with a version here, try upgrade instead");
   }
 }
 
-
-# FIXME ensure option spec compatability
-#die('Do not use the where option with the insert op') if ($where);
-#die('Do not use the attrs option with the insert op') if ($attrs);
-
-
 =head2 insert
 
 =over 4
@@ -509,10 +486,7 @@
   }
 }
 
-# FIXME
-#die('Do not use the set option with the delete op') if ($set);
 
-
 =head2 delete
 
 =over 4
@@ -599,7 +573,7 @@
       $cfg = $cfg->{$path};
     }
     else {
-      die "could not find $stanza in config, $path did not seem to exist";
+      $self->throw_exception("could not find $stanza in config, $path did not seem to exist");
     }
   }
   return $cfg;




More information about the Bast-commits mailing list