1 package App::SCS::Plugin::Core;
3 use Module::Runtime qw(use_module);
6 no warnings::illegalproto;
9 with 'App::SCS::Role::Plugin';
11 has templates => (is => 'lazy');
13 sub _build_templates {
15 return use_module('App::SCS::PageSet')->new(
16 base_dir => io->dir($self->app->share_dir)->catdir('templates'),
18 plugin_map => $self->app->page_plugin_config->{plugin_map}
23 has includes => (is => 'lazy');
27 return use_module('App::SCS::PageSet')->new(
28 base_dir => io->dir($self->app->config->{share_dir})->catdir('includes'),
34 PageList => 'App::SCS::Plugin::Core::PagePlugin::PageList',
36 class => 'App::SCS::Plugin::Core::PagePlugin::Template',
37 config => sub { templates => $self->templates },
40 class => 'App::SCS::Plugin::Core::PagePlugin::Include',
41 config => sub { includes => $self->includes },
43 PageData => 'App::SCS::Plugin::Core::PagePlugin::PageData',
46 sub default_page_plugins {
53 sub page_dispatchers {
56 $self->pages->get({ path => 'index' });
59 [ 302, [ 'Location' => "/$_[1]/" ], [] ]
62 $self->pages->get({ %_ })
66 ->get({ path => 'error_404' })
67 ->$_call_if_object(with_plugin_config => Status => 404);
73 "/", map "$_/", $self->pages->all_paths;