1 package SCSite::DevMode;
8 has _static_handler => (is => 'lazy');
10 sub _build__static_handler {
12 my $static_dir = $self->config->{static_dir};
13 Plack::App::File->new(root => $static_dir);
16 around dispatch_request => sub {
17 my ($orig, $self) = (shift, shift);
18 no warnings::illegalproto;
21 my ($self, $path) = @_;
22 return unless $path =~ s/\/-/\//;
23 SCSite::redispatch_to "/static/${path}";
25 sub (/static/...) { $self->_static_handler },
26 sub (/favicon + .ico) { $self->_static_handler },
32 my ($self, @args) = @_;
33 my $r = Plack::Runner->new(server => 'Starman', app => $self->to_psgi_app);
34 $r->parse_options(@args);
35 $r->set_options(argv => \@args);
39 sub _run_dev_checkall {
41 my $ps = $self->pages;
42 foreach my $path ($ps->all_paths) {
44 $ps->get({ path => $path });
47 print "ERROR ${path}\n";