get metaclass using preferred mechanism, via Moose
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Test.pm
index 33602d6..e121b35 100644 (file)
@@ -9,6 +9,7 @@ use Catalyst::Exception;
 use Catalyst::Utils;
 use Class::Load qw(load_class is_class_loaded);
 use Sub::Exporter;
+use Moose::Util 'find_meta';
 use Carp 'croak', 'carp';
 
 sub _build_request_export {
@@ -58,7 +59,7 @@ sub _build_ctx_request_export {
 
         # hook into 'dispatch' -- the function gets called after all plugins
         # have done their work, and it's an easy place to capture $c.
-        my $meta = Class::MOP::get_metaclass_by_name($class);
+        my $meta = find_meta($class);
         $meta->make_mutable;
         $meta->add_after_method_modifier( "dispatch", sub {
             $ctx_closed_over = shift;