blib/lib/Statocles/Page/File.pm

filter: Statementstmt 64.2% 9 / 14 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 40.0% 2 / 5 Podpod 100% 4 / 4 totaltotal 60.0% 15 / 25 CC 2 SCAR 11.0
CC
2
Cov
56%
render
6.0
vars
2.0
dom
2.0
CRAP 3.0
« blib/lib/Statocles/Person.pm ↑ Summary blib/lib/Statocles/Plugin/Diagram/Mermaid.pm »
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
BranchTrueFalseTotal
$self->file_path ? : 0 0 0
69 }
70  
71 53 1;
72  
73 __END__
« blib/lib/Statocles/Person.pm ↑ Summary blib/lib/Statocles/Plugin/Diagram/Mermaid.pm »