basic porting work for SCSite
[scpubgit/App-SCS.git] / lib / App / SCS / Role / Plugin.pm
1 package App::SCS::Role::Plugin;
2
3 use Moo::Role;
4
5 with 'App::SCS::Role::WithConfig';
6
7 has app => (
8   is => 'ro', weak_ref => 1, required => 1,
9   handles => [ 'pages' ],
10 );
11
12 sub page_plugins { () }
13
14 sub default_page_plugins { () }
15
16 sub page_dispatchers { () }
17
18 sub provides_pages { () }
19
20 sub register { return }
21
22 sub run_cli {
23   my ($self, $env) = @_;
24   my ($command, @argv) = @{$env->{argv}};
25   return unless $command;
26   return unless $self->can(my $meth = "run_command_${command}");
27   $self->$meth({ argv => \@argv, %$env });
28   return 1;
29 }
30
31 1;