Commits

juster  committed 52e48af

Removes unused code. Adds more shared variables for params and headers.

  • Participants
  • Parent commits 46909df

Comments (0)

Files changed (1)

File lib/Web/Deux.pm

 use strict;
 
 use Plack::Request qw();
-use Carp qw();
-# use B    qw();
 
-our ( $Args, $HTTP, @Shared_Symbols );
+our ( $Headers, $Get, $Post, $Args, $Method, @Shared_Symbols );
 
 sub def_shared
 {
     push @Shared_Symbols, @_;
 }
 
-BEGIN { def_shared( qw/ Args HTTP / ); }
+BEGIN { def_shared( qw/ Headers Get Post Args Method / ); }
 
 sub import
 {
 
     my $routes_ref = $pkg->_routes;
 
-    return $pkg->_dispatch_internal( "__${HTTP}__" ) unless $pathcomp;
+    return $pkg->_dispatch_internal( "__${Method}__" ) unless $pathcomp;
 
     FROUTE_LOOP:
     for my $subname ( @$routes_ref ) {
         $match  ||= $subname;
 
         $method = 'DELETE' if $method eq 'DEL';
-        next FROUTE_LOOP   if $method ne $HTTP; # $HTTP is shared
+        next FROUTE_LOOP   if $method ne $Method; # $Method is shared
         next FROUTE_LOOP   unless lc $match eq lc $pathcomp;
 
         no strict 'refs';
         return $pkg->_dispatch_internal( $coderef, @_ );
     }
 
-    return $pkg->_dispatch_internal( "__${HTTP}__", $pathcomp, @_ );
+    return $pkg->_dispatch_internal( "__${Method}__", $pathcomp, @_ );
 }
 
 sub _dispatch_internal
 }
 
 #-----------------------------------------------------------------------------
-# PSGI EXTERNAL INTERFACE
+# PLACK EXTERNAL INTERFACE
 #-----------------------------------------------------------------------------
 
 sub to_app
 
         my $req = Plack::Request->new( $psgi );
 
-        $HTTP = $req->method;
-        $Args = ( $HTTP eq 'POST'
-                  ? $req->body_parameters
-                  : $req->query_parameters );
+        $Headers = $req->headers;
+        $Method  = $req->method;
+        $Get     = $req->query_parameters;
+        $Post    = $req->body_parameters;
+        $Args    = $req->parameters;
 
         my $response = $pkg->dispatch( grep { length } split m{/}, $req->path );