Skip to content

Instantly share code, notes, and snippets.

@gmodecorp
Last active August 29, 2015 14:05
Show Gist options
  • Save gmodecorp/7be54d39d35dbf9d4c15 to your computer and use it in GitHub Desktop.
Save gmodecorp/7be54d39d35dbf9d4c15 to your computer and use it in GitHub Desktop.
Web Server初期化・起動処理
# セットアップ処理をしています。
sub BUILD {
my $self = shift;
$self->setup_dispatcher();
$self->setup_view();
$self->setup_context();
}
# PSGIの仕様にそって、関数の参照を返却しています。
sub to_app {
my $self = shift;
my $app = sub {
my $env = shift;
local $Ze::GLOBAL = {};
my $c = $self->prepare_context( $env );
$c->dispatch();
};
return $app;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment