Stop loading Time::HiRes in the base test schema - there is no need
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Schema / Versioned.pm
index ba3b445..2f130f6 100644 (file)
@@ -202,8 +202,7 @@ use warnings;
 use base 'DBIx::Class::Schema';
 
 use DBIx::Class::Carp;
-use Time::HiRes qw/gettimeofday/;
-use Try::Tiny;
+use DBIx::Class::_Util 'dbic_internal_try';
 use Scalar::Util 'weaken';
 use namespace::clean;
 
@@ -527,7 +526,7 @@ sub get_db_version
     my ($self, $rs) = @_;
 
     my $vtable = $self->{vschema}->resultset('Table');
-    my $version = try {
+    my $version = dbic_internal_try {
       $vtable->search({}, { order_by => { -desc => 'installed' }, rows => 1 } )
               ->get_column ('version')
                ->next;
@@ -710,7 +709,8 @@ sub _set_db_version {
   # not possible to format the string sanely, as the column is a varchar(20).
   # The 'v' character is added to the front of the string, so that any version
   # formatted by this new function will sort _after_ any existing 200... strings.
-  my @tm = gettimeofday();
+  require Time::HiRes;
+  my @tm = Time::HiRes::gettimeofday();
   my @dt = gmtime ($tm[0]);
   my $o = $vtable->new_result({
     version => $version,
@@ -746,14 +746,15 @@ sub _read_sql_file {
 
 sub _source_exists
 {
-    my ($self, $rs) = @_;
-
-    return try {
-      $rs->search(\'1=0')->cursor->next;
-      1;
-    } catch {
-      0;
-    };
+  my ($self, $rs) = @_;
+
+  ( dbic_internal_try {
+    $rs->search(\'1=0')->cursor->next;
+    1;
+  } )
+    ? 1
+    : 0
+  ;
 }
 
 =head1 FURTHER QUESTIONS?