Plack::Middleware::Scope::ContainerPer-request container | |
Download |
Plack::Middleware::Scope::Container Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Masahiro Nagano
- Publisher web site:
- http://search.cpan.org/~kazeburo/
Plack::Middleware::Scope::Container Tags
Plack::Middleware::Scope::Container Description
Plack::Middleware::Scope::Container and Scope::Container are Perl modules that work like mod_perl's pnotes. It gives a per-request container to your application.SYNOPSIS use Plack::Builder; builder { enable "Plack::Middleware::Scope::Container"; $app }; # in your application package MyApp; use Scope::Container; sub getdb { if ( my $dbh = scope_container('db') ) { return $dbh; } else { my $dbh = DBI->connect(...); scope_container('db', $dbh) return $dbh; } } sub app { my $env = shift; getdb(); # do connect getdb(); # from container getdb(); # from container return ]; # disconnect from db at end of request }Product's homepage
Plack::Middleware::Scope::Container Related Software