| 1 | package Statocles::Page::File; | ||||||||||
| 2 | 53 | our $VERSION = '0.099'; | |||||||||
| 3 | # ABSTRACT: A page wrapping a file (handle) | ||||||||||
| 4 | |||||||||||
| 5 | 53 | ▶ | use Statocles::Base 'Class'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 53 | with 'Statocles::Page'; | |||||||||
| 7 | |||||||||||
| 8 | #pod =attr file_path | ||||||||||
| 9 | #pod | ||||||||||
| 10 | #pod The path to the file. | ||||||||||
| 11 | #pod | ||||||||||
| 12 | #pod =cut | ||||||||||
| 13 | |||||||||||
| 14 | 53 | has file_path => ( | |||||||||
| 15 | is => 'ro', | ||||||||||
| 16 | isa => Path, | ||||||||||
| 17 | coerce => Path->coercion, | ||||||||||
| 18 | ); | ||||||||||
| 19 | |||||||||||
| 20 | #pod =attr fh | ||||||||||
| 21 | #pod | ||||||||||
| 22 | #pod The file handle containing the contents of the page. | ||||||||||
| 23 | #pod | ||||||||||
| 24 | #pod =cut | ||||||||||
| 25 | |||||||||||
| 26 | 53 | has fh => ( | |||||||||
| 27 | is => 'ro', | ||||||||||
| 28 | isa => FileHandle, | ||||||||||
| 29 | ); | ||||||||||
| 30 | |||||||||||
| 31 | #pod =method vars | ||||||||||
| 32 | #pod | ||||||||||
| 33 | #pod Dies. This page has no templates and no template variables. | ||||||||||
| 34 | #pod | ||||||||||
| 35 | #pod =cut | ||||||||||
| 36 | |||||||||||
| 37 | # XXX: This may have to be implemented in the future, to allow for some useful edge | ||||||||||
| 38 | # cases. | ||||||||||
| 39 | 0 | ▶ | sub vars { die "Unimplemented" } | ||||||||
|
Subroutine
vars: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 40 | |||||||||||
| 41 | #pod =attr dom | ||||||||||
| 42 | #pod | ||||||||||
| 43 | #pod This page has no DOM, so trying to access it throws an exception. | ||||||||||
| 44 | #pod | ||||||||||
| 45 | #pod =cut | ||||||||||
| 46 | |||||||||||
| 47 | 0 | ▶ | sub dom { die "Unimplemented" } | ||||||||
|
Subroutine
dom: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 48 | |||||||||||
| 49 | #pod =method has_dom | ||||||||||
| 50 | #pod | ||||||||||
| 51 | #pod Returns false. This page has no DOM. | ||||||||||
| 52 | #pod | ||||||||||
| 53 | #pod =cut | ||||||||||
| 54 | |||||||||||
| 55 | 6 | ▶ | sub has_dom { 0 } | ||||||||
|
Subroutine
has_dom: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 56 | |||||||||||
| 57 | #pod =method render | ||||||||||
| 58 | #pod | ||||||||||
| 59 | #pod my $fh = $page->render; | ||||||||||
| 60 | #pod | ||||||||||
| 61 | #pod Return the filehandle to the file containing the content for this page. | ||||||||||
| 62 | #pod | ||||||||||
| 63 | #pod =cut | ||||||||||
| 64 | |||||||||||
| 65 | 0 | ▶ | sub render { | ||||||||
|
Subroutine
render: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 66 | 0 | my ( $self ) = @_; | |||||||||
| 67 | 0 | $self->site->log->debug( 'Render page: ' . $self->path ); | |||||||||
| 68 | 0 | ▶ | return $self->file_path ? $self->file_path : $self->fh; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 69 | } | ||||||||||
| 70 | |||||||||||
| 71 | 53 | 1; | |||||||||
| 72 | |||||||||||
| 73 | __END__ | ||||||||||