Do not load DBIC::Optional::Dependencies at runtime unless we need to
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Schema / Versioned.pm
index d59961f..c155360 100644 (file)
@@ -203,7 +203,6 @@ use base 'DBIx::Class::Schema';
 
 use DBIx::Class::Carp;
 use DBIx::Class::_Util 'dbic_internal_try';
-use Time::HiRes qw/gettimeofday/;
 use Scalar::Util 'weaken';
 use namespace::clean;
 
@@ -642,6 +641,7 @@ sub _create_db_to_schema_diff {
     return;
   }
 
+  require DBIx::Class::Optional::Dependencies;
   if ( my $missing = DBIx::Class::Optional::Dependencies->req_missing_for('deploy') ) {
     $self->throw_exception("Unable to proceed without $missing");
   }
@@ -710,7 +710,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,