my $remote = My::Data::TestModuleRuntime->new::on($connection);
is($remote->counter, 0, 'Counter at 0');
is($remote->increment, 1, 'Increment to 1');
- is($remote->has_missing_module, 0, 'Shouldn\'t have loaded module');
+ like exception {
+ my $o = $remote->create_object;
+ }, qr/Can't locate Not\/Found.pm in \@INC/, 'Should fail to load Not::Found';
+
}, undef, 'Checking Module::Runtime use_package_optimistically works correctly.';
done_testing;
sub increment { $_[0]->_set_counter($_[0]->counter + 1); }
-sub has_missing_module { HAS_MISSING_MODULE };
+sub create_object { use_package_optimistically('Not::Found')->new() };