| 1 | #!perl | ||
| 2 | |||
| 3 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 2 | ▶ | use Web::Machine; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | { | ||
| 9 | package HelloWorld::Resource; | ||
| 10 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | 2 | ▶ | use parent 'Web::Machine::Resource'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | |||
| 15 | 3 | ▶ | sub content_types_provided { [{ 'text/html' => 'to_html' }] } |
|
Subroutine
content_types_provided: called CC=1 SCAR=0.0
| |||
| 16 | |||
| 17 | 1 | ▶ | sub to_html { |
|
Subroutine
to_html: called CC=1 SCAR=0.0
| |||
| 18 | 1 | join "" => | |
| 19 | '<html>', | ||
| 20 | '<head>', | ||
| 21 | '<title>Hello World Resource</title>', | ||
| 22 | '</head>', | ||
| 23 | '<body>', | ||
| 24 | '<h1>Hello World</h1>', | ||
| 25 | '</body>', | ||
| 26 | '</html>' | ||
| 27 | } | ||
| 28 | } | ||
| 29 | |||
| 30 | 2 | Web::Machine->new( resource => 'HelloWorld::Resource' )->to_app; | |