[Catalyst-commits] r9936 - Catalyst-Runtime/5.80/trunk/lib/Catalyst
rafl at dev.catalyst.perl.org
rafl at dev.catalyst.perl.org
Wed Apr 29 10:45:25 GMT 2009
Author: rafl
Date: 2009-04-29 11:45:25 +0100 (Wed, 29 Apr 2009)
New Revision: 9936
Modified:
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Dispatcher.pm
Log:
Convert the dispatcher's BUILD method to attribute builders.
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Dispatcher.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Dispatcher.pm 2009-04-29 10:45:18 UTC (rev 9935)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Dispatcher.pm 2009-04-29 10:45:25 UTC (rev 9936)
@@ -15,6 +15,7 @@
use Tree::Simple;
use Tree::Simple::Visitor::FindByPath;
+use namespace::clean -except => 'meta';
# Refactoring note:
# do these belong as package vars or should we build these via a builder method?
@@ -27,7 +28,7 @@
our @POSTLOAD = qw/Default/;
# Note - see back-compat methods at end of file.
-has _tree => (is => 'rw');
+has _tree => (is => 'rw', builder => '_build__tree');
has _dispatch_types => (is => 'rw', default => sub { [] }, required => 1, lazy => 1);
has _registered_dispatch_types => (is => 'rw', default => sub { {} }, required => 1, lazy => 1);
has _method_action_class => (is => 'rw', default => 'Catalyst::Action');
@@ -45,8 +46,6 @@
return $self->$orig(@_);
};
-no Moose;
-
=head1 NAME
Catalyst::Dispatcher - The Catalyst Dispatcher
@@ -68,13 +67,13 @@
=cut
-sub BUILD {
- my ($self, $params) = @_;
+sub _build__tree {
+ my ($self) = @_;
my $container =
Catalyst::ActionContainer->new( { part => '/', actions => {} } );
- $self->_tree( Tree::Simple->new( $container, Tree::Simple->ROOT ) );
+ return Tree::Simple->new($container, Tree::Simple->ROOT);
}
=head2 $self->preload_dispatch_types
@@ -718,7 +717,6 @@
}
# End 5.70 backwards compatibility hacks.
-no Moose;
__PACKAGE__->meta->make_immutable;
=head2 meta
More information about the Catalyst-commits
mailing list