X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage.pm;h=c9f4383469ff77cce03a4e24b3b45dd835cd931d;hb=4225194590a09e29451ba825c34483f98c1a0c03;hp=a38cf4701bbf73665fca76742a8ca91cb38d6156;hpb=6f4ddea126a20d67bc599a804d097ed8d3c086aa;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage.pm b/lib/DBIx/Class/Storage.pm index a38cf47..c9f4383 100644 --- a/lib/DBIx/Class/Storage.pm +++ b/lib/DBIx/Class/Storage.pm @@ -4,9 +4,10 @@ use strict; use warnings; use base qw/DBIx::Class/; +use mro 'c3'; -use Scalar::Util qw/weaken/; -use Carp::Clan qw/^DBIx::Class/; +use DBIx::Class::Exception; +use Scalar::Util(); use IO::File; use DBIx::Class::Storage::TxnScopeGuard; @@ -82,7 +83,7 @@ storage object, such as during L. sub set_schema { my ($self, $schema) = @_; $self->schema($schema); - weaken($self->{schema}) if ref $self->{schema}; + Scalar::Util::weaken($self->{schema}) if ref $self->{schema}; } =head2 connected @@ -119,8 +120,12 @@ Throws an exception - croaks. sub throw_exception { my $self = shift; - $self->schema->throw_exception(@_) if $self->schema; - croak @_; + if ($self->schema) { + $self->schema->throw_exception(@_); + } + else { + DBIx::Class::Exception->throw(@_); + } } =head2 txn_do @@ -248,6 +253,9 @@ sub txn_begin { die "Virtual method!" } Issues a commit of the current transaction. +It does I perform an actual storage commit unless there's a DBIx::Class +transaction currently in effect (i.e. you called L). + =cut sub txn_commit { die "Virtual method!" }