File: 100-add-caching.psgi

package info (click to toggle)
libweb-machine-perl 0.17-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 940 kB
  • sloc: perl: 5,481; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 729 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!perl

use strict;
use warnings;

use Web::Machine;

=pod

curl -v http://0:5000/ -H 'If-Modified-Since: Sun, 27 May 2012 21:34:59 GMT'

curl -v http://0:5000/ -H 'If-Modified-Since: Sun, 27 May 2012 21:35:00 GMT'

=cut

{
    package YAPC::NA::2012::Example100::Resource;
    use strict;
    use warnings;

    use Web::Machine::Util qw[ create_date ];

    use parent 'Web::Machine::Resource';

    sub content_types_provided { [{ 'text/html' => 'to_html' }] }

    sub last_modified { create_date('Sun, 27 May 2012 21:35:00 GMT') }
    sub generate_etag { '0xDEADBEEF' }

    sub to_html { '<html><body><h1>Hello World</h1></body></html>' }
}

Web::Machine->new( resource => 'YAPC::NA::2012::Example100::Resource' )->to_app;