Skip to content

Instantly share code, notes, and snippets.

@theory
Created October 14, 2010 22:41
Show Gist options
  • Save theory/627229 to your computer and use it in GitHub Desktop.
Save theory/627229 to your computer and use it in GitHub Desktop.
Router::Resource::Match
package Router::Resource::Match;
my $def = __PACKAGE__->new(sub { [405], [], ['Method not allowed' ] });
sub not_allowed { $def }
sub new {
my ($class, $code) = @_;
bless $code => $class;
}
sub execute { shift->(); }
sub code { shift eq $def ? 405 : 200 };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment