X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FODBC.pm;h=8f2642c099e48d3310ac79f4f316cc77f3ef3caf;hb=4f6610511b1211322b0bcee2eeea48ceb2a362b9;hp=f8e92098ac425b9260bc110fbca8dae102d82b79;hpb=243d702ea2d1350e9c08d52eb84cdde745913452;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/Storage/DBI/ODBC.pm b/lib/DBIx/Class/Storage/DBI/ODBC.pm index f8e9209..8f2642c 100644 --- a/lib/DBIx/Class/Storage/DBI/ODBC.pm +++ b/lib/DBIx/Class/Storage/DBI/ODBC.pm @@ -4,21 +4,23 @@ use warnings; use base qw/DBIx::Class::Storage::DBI/; use mro 'c3'; +use Try::Tiny; sub _rebless { - my ($self) = @_; - - my $dbtype = eval { $self->_get_dbh->get_info(17) }; - - unless ( $@ ) { - # Translate the backend name into a perl identifier - $dbtype =~ s/\W/_/gi; - my $subclass = "DBIx::Class::Storage::DBI::ODBC::${dbtype}"; - if ($self->load_optional_class($subclass) && !$self->isa($subclass)) { - bless $self, $subclass; - $self->_rebless; - } + my ($self) = @_; + + try { + my $dbtype = $self->_get_dbh->get_info(17); + + # Translate the backend name into a perl identifier + $dbtype =~ s/\W/_/gi; + my $subclass = "DBIx::Class::Storage::DBI::ODBC::${dbtype}"; + + if ($self->load_optional_class($subclass) && !$self->isa($subclass)) { + bless $self, $subclass; + $self->_rebless; } + }; } 1;