TPSGI.pm 846 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package Plack::Handler::TPSGI;
  2. # ABSTRACT: Plack::Handler::Starman, running TPSGI::Server
  3. use 5.040;
  4. use warnings FATAL => 'all';
  5. use re '/aasx';
  6. use parent qw{Plack::Handler::Starman};
  7. use TPSGI::Server;
  8. =head1 Plack::Handler::TPSGI
  9. Plack::Handler::Starman, running TPSGI::Server instead of Starman::Server.
  10. bin/tarbaby asks Plack::Runner for it as C<server =E<gt> 'TPSGI'>.
  11. =head2 run($app)
  12. Plack::Handler::Starman::run() names Starman::Server outright, so this is
  13. that, less its Server::Starter support, which tPSGI does not use.
  14. =cut
  15. sub run {
  16. my ( $self, $app ) = @_;
  17. my %nsa;
  18. foreach my $key ( keys %$self ) {
  19. ( my $name = $key ) =~ s/^net_server_// or next;
  20. $nsa{$name} = $self->{$key};
  21. }
  22. $self->{net_server_args} = \%nsa if %nsa;
  23. return TPSGI::Server->new->run( $app, {%$self} );
  24. }
  25. 1;