fix typo in FATAL ERROR message.
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Schema.pm
index 0d49b4b..16a0878 100644 (file)
@@ -3,7 +3,8 @@ package DBIx::Class::Schema;
 use strict;
 use warnings;
 
-use DBIx::Class::Exception;
+use base 'DBIx::Class';
+
 use DBIx::Class::Carp;
 use Try::Tiny;
 use Scalar::Util qw/weaken blessed/;
@@ -12,8 +13,6 @@ use B 'svref_2object';
 use Devel::GlobalDestruction;
 use namespace::clean;
 
-use base qw/DBIx::Class/;
-
 __PACKAGE__->mk_classdata('class_mappings' => {});
 __PACKAGE__->mk_classdata('source_registrations' => {});
 __PACKAGE__->mk_classdata('storage_type' => '::DBI');
@@ -74,12 +73,13 @@ particular which module inherits off which.
 
 =back
 
+  package MyApp::Schema;
   __PACKAGE__->load_namespaces();
 
   __PACKAGE__->load_namespaces(
      result_namespace => 'Res',
      resultset_namespace => 'RSet',
-     default_resultset_class => '+MyDB::Othernamespace::RSet',
+     default_resultset_class => '+MyApp::Othernamespace::RSet',
   );
 
 With no arguments, this method uses L<Module::Find> to load all of the
@@ -618,8 +618,7 @@ Retrieves the Result class name for the given source name.
 =cut
 
 sub class {
-  my ($self, $source_name) = @_;
-  return $self->source($source_name)->result_class;
+  return shift->source(shift)->result_class;
 }
 
 =head2 txn_do
@@ -770,15 +769,10 @@ those values.
 
 sub populate {
   my ($self, $name, $data) = @_;
-  if(my $rs = $self->resultset($name)) {
-    if(defined wantarray) {
-        return $rs->populate($data);
-    } else {
-        $rs->populate($data);
-    }
-  } else {
-      $self->throw_exception("$name is not a resultset");
-  }
+  my $rs = $self->resultset($name)
+    or $self->throw_exception("'$name' is not a resultset");
+
+  return $rs->populate($data);
 }
 
 =head2 connection
@@ -841,7 +835,7 @@ sub _normalize_storage_type {
 
 =item Arguments: $target_namespace, $additional_base_class?
 
-=item Retur Value: $new_schema
+=item Return Value: $new_schema
 
 =back
 
@@ -1007,7 +1001,7 @@ sub svp_rollback {
 
 Clones the schema and its associated result_source objects and returns the
 copy. The resulting copy will have the same attributes as the source schema,
-except for those attributes explicitly overriden by the provided C<%attrs>.
+except for those attributes explicitly overridden by the provided C<%attrs>.
 
 =cut
 
@@ -1064,7 +1058,6 @@ default behavior will provide a detailed stack trace.
 
 =cut
 
-my $false_exception_action_warned;
 sub throw_exception {
   my $self = shift;
 
@@ -1077,13 +1070,12 @@ sub throw_exception {
         ." (original error: $_[0])"
       );
     }
-    elsif(! $false_exception_action_warned++) {
-      carp (
-          "The exception_action handler installed on $self returned false instead"
-        .' of throwing an exception. This behavior has been deprecated, adjust your'
-        .' handler to always rethrow the supplied error.'
-      );
-    }
+
+    carp_unique (
+      "The exception_action handler installed on $self returned false instead"
+    .' of throwing an exception. This behavior has been deprecated, adjust your'
+    .' handler to always rethrow the supplied error.'
+    );
   }
 
   DBIx::Class::Exception->throw($_[0], $self->stacktrace);
@@ -1102,8 +1094,7 @@ Attempts to deploy the schema to the current storage using L<SQL::Translator>.
 See L<SQL::Translator/METHODS> for a list of values for C<\%sqlt_args>.
 The most common value for this would be C<< { add_drop_table => 1 } >>
 to have the SQL produced include a C<DROP TABLE> statement for each table
-created. For quoting purposes supply C<quote_table_names> and
-C<quote_field_names>.
+created. For quoting purposes supply C<quote_identifiers>.
 
 Additionally, the DBIx::Class parser accepts a C<sources> parameter as a hash
 ref or an array ref, containing a list of source to deploy. If present, then