import "builder" into the right namespace - thanks, gbhat!
[catagits/Web-Simple.git] / lib / Web / Simple / Application.pm
index fc72cd0..65919ad 100644 (file)
@@ -25,7 +25,6 @@ has '_dispatcher' => (is => 'lazy');
 sub _build__dispatcher {
   my $self = shift;
   require Web::Dispatch;
-  require Web::Simple::DispatchNode;
   my $final = $self->_build_final_dispatcher;
 
   # We need to weaken both the copy of $self that the
@@ -37,13 +36,12 @@ sub _build__dispatcher {
   # closes back over $self
 
   weaken($self);
-  my $node_args = { app_object => $self };
-  weaken($node_args->{app_object});
-  Web::Dispatch->new(
+  my %dispatch_args = (
     dispatch_app => sub { $self->dispatch_request(@_), $final },
-    node_class => 'Web::Simple::DispatchNode',
-    node_args => $node_args
+    dispatch_object => $self
   );
+  weaken($dispatch_args{dispatch_object});
+  Web::Dispatch->new(%dispatch_args);
 }
 
 sub _build_final_dispatcher {
@@ -326,11 +324,10 @@ for use via L<Plack> and L<plackup>. If you want to globally add middleware,
 you can override this method:
 
   use Web::Simple 'HelloWorld';
-  use Plack::Builder;
  
   {
     package HelloWorld;
-
+    use Plack::Builder;
   
     around 'to_psgi_app', sub {
       my ($orig, $self) = (shift, shift);