From: Matt S Trout Date: Wed, 13 Feb 2013 16:10:30 +0000 (+0000) Subject: actions plugin X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ea38c46df0ee43c73500859b3061f7494dc5e5b3;p=scpubgit%2FApp-SCS.git actions plugin --- diff --git a/lib/App/SCS/Plugin/Actions.pm b/lib/App/SCS/Plugin/Actions.pm new file mode 100644 index 0000000..ff85cdf --- /dev/null +++ b/lib/App/SCS/Plugin/Actions.pm @@ -0,0 +1,29 @@ +package App::SCS::Plugin::Actions; + +use Module::Runtime qw(use_module); +use IO::All; +use Moo; + +with 'App::SCS::Role::Plugin'; + +has mount_at => (is => 'ro', default => sub { 'actions' }); + +has dispatcher => (is => 'lazy', builder => sub { + my ($self) = @_; + use_module('Plack::App::PSGIBin')->new( + root => io->dir($self->app->share_dir)->catdir('actions') + ); +}); + +sub page_dispatchers { + my ($self) = @_; + my $base = $self->mount_at; + "/${base}/..." => sub { $self->dispatcher }, +} + +sub provides_pages { + my ($self) = @_; + return; +} + +1;