Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Plack::Middleware::Auth::Basic::Ex;
- use strict;
- use warnings;
- use parent qw/Plack::Middleware::Auth::Basic/;
- use Plack::Util::Accessor qw( exclude_path );
- sub prepare_app {
- my $self = shift;
- $self->SUPER::prepare_app;
- my $regex = $self->exclude_path;
- if ($regex && uc(ref $regex) ne 'REGEXP') {
- die 'exclude_path should be a regexp reference';
- }
- }
- sub call {
- my($self, $env) = @_;
- my $path = $env->{PATH_INFO};
- if (my $regex = $self->exclude_path) {
- return $self->app->($env) if ($path =~ m/$regex/);
- }
- $self->SUPER::call($env);
- }
- 1;
Add Comment
Please, Sign In to add comment