« examples/yapc-talk-examples/030-postback.psgi
↑ Summary
examples/yapc-talk-examples/130-tracing-header.psgi »
| 1 | #!perl | ||
| 2 | |||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 1 | ▶ | use Web::Machine; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | =pod | ||
| 9 | |||
| 10 | curl -v http://0:5000/ -H 'If-Modified-Since: Sun, 27 May 2012 21:34:59 GMT' | ||
| 11 | |||
| 12 | curl -v http://0:5000/ -H 'If-Modified-Since: Sun, 27 May 2012 21:35:00 GMT' | ||
| 13 | |||
| 14 | =cut | ||
| 15 | |||
| 16 | { | ||
| 17 | package YAPC::NA::2012::Example100::Resource; | ||
| 18 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 19 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 20 | |||
| 21 | 1 | ▶ | use Web::Machine::Util qw[ create_date ]; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 22 | |||
| 23 | 1 | ▶ | use parent 'Web::Machine::Resource'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 24 | |||
| 25 | 8 | ▶ | sub content_types_provided { [{ 'text/html' => 'to_html' }] } |
|
Subroutine
content_types_provided: called CC=1 SCAR=0.0
| |||
| 26 | |||
| 27 | 7 | ▶ | sub last_modified { create_date('Sun, 27 May 2012 21:35:00 GMT') } |
|
Subroutine
last_modified: called CC=1 SCAR=0.0
| |||
| 28 | 3 | ▶ | sub generate_etag { '0xDEADBEEF' } |
|
Subroutine
generate_etag: called CC=1 SCAR=0.0
| |||
| 29 | |||
| 30 | 2 | ▶ | sub to_html { '<html><body><h1>Hello World</h1></body></html>' } |
|
Subroutine
to_html: called CC=1 SCAR=0.0
| |||
| 31 | } | ||
| 32 | |||
| 33 | 1 | Web::Machine->new( resource => 'YAPC::NA::2012::Example100::Resource' )->to_app; | |