Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/masak/web
Browse files Browse the repository at this point in the history
Conflicts:
	lib/Astaire.pm
  • Loading branch information
arthur committed Aug 14, 2009
2 parents 50379bc + 36025de commit 47193cc
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions lib/Astaire.pm
Expand Up @@ -17,12 +17,18 @@ class Handler {
# RAKUDO : submethod BUILD doesn't work ( forgets its args ), we should eval the regex only on BUILD and then store it
my $condition_regex = (eval " $condition ");
my $match = $clean_path.match($condition_regex);
my @splat = @($match).map({ ~$_ });
%result{'splat'} = @splat;
%result{'success'} = ?($match);
%result<splat> = @($match).map({ ~$_ });
%result<success> = ?($match);
return %result;
}

method explode( Str $target ){
my @path = $target.split('/');
@path.shift() if @path[0] eq '';
return @path

}

};

class Dispatch {
Expand All @@ -38,9 +44,8 @@ class Dispatch {
for @.handlers -> $candidate {
my %match = $candidate.matches( $request.path_info );
if %match{'success'} and $candidate.http_method eq $request.request_method {
%match{'splat'}.perl.say;
my $code = $candidate.code;
$response.write( $code(|%match) );
$response.write( $code(|%match<splat>) );
return $response;
}
}
Expand Down Expand Up @@ -87,9 +92,3 @@ module Astaire {
return $application;
}
};






0 comments on commit 47193cc

Please sign in to comment.