mro compat stuff
[catagits/Catalyst-Runtime.git] / lib / Catalyst / DispatchType / Path.pm
index 925b4ac..98e3b97 100644 (file)
@@ -1,18 +1,22 @@
 package Catalyst::DispatchType::Path;
 
+use MRO::Compat;
+use mro 'c3';
 use Moose;
+extends 'Catalyst::DispatchType';
+
 use Text::SimpleTable;
 use URI;
 
-extends 'Catalyst::DispatchType';
-
 has _paths => (
                is => 'rw',
                isa => 'HashRef',
                required => 1,
-               default => sub {{}}
+               default => sub { +{} },
               );
 
+no Moose;
+
 =head1 NAME
 
 Catalyst::DispatchType::Path - Path DispatchType
@@ -33,17 +37,15 @@ Debug output for Path dispatch points
 
 sub list {
     my ( $self, $c ) = @_;
-    my %paths = %{ $self->_paths };
-    my @keys = sort keys %paths;
-    return unless @keys;
-    my $paths_table = Text::SimpleTable->new( [ 35, 'Path' ], [ 36, 'Private' ] );
-    foreach my $path ( @keys ) {
+    my $paths = Text::SimpleTable->new( [ 35, 'Path' ], [ 36, 'Private' ] );
+    foreach my $path ( sort keys %{ $self->_paths } ) {
         my $display_path = $path eq '/' ? $path : "/$path";
-        foreach my $action ( @{ $paths{$path} } ) {
-            $paths_table->row( $display_path, "/$action" );
+        foreach my $action ( @{ $self->_paths->{$path} } ) {
+            $paths->row( $display_path, "/$action" );
         }
     }
-    $c->log->debug( "Loaded Path actions:\n" . $paths_table->draw . "\n" );
+    $c->log->debug( "Loaded Path actions:\n" . $paths->draw . "\n" )
+      if ( keys %{ $self->_paths } );
 }
 
 =head2 $self->match( $c, $path )
@@ -140,4 +142,6 @@ the same terms as Perl itself.
 
 =cut
 
+__PACKAGE__->meta->make_immutable;
+
 1;