File Coverage

blib/lib/Dancer/Plugin/PageHistory/Page.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 22 22 100.0


line stmt bran cond sub pod time code
1             package Dancer::Plugin::PageHistory::Page;
2              
3             =head1 NAME
4              
5             Dancer::Plugin::PageHistory::Page - Page object for Dancer::Plugin::PageHistory
6              
7             =cut
8              
9 4     4   48174 use Moo;
  4         29792  
  4         26  
10 4     4   5377 use Types::Standard qw(Str HashRef);
  4         138662  
  4         54  
11 4     4   4902 use URI;
  4         8827  
  4         119  
12 4     4   1350 use namespace::clean;
  4         23551  
  4         34  
13              
14             =head1 ATTRIBUTES
15              
16             =head2 attributes
17              
18             Extra attributes as a hash reference, e.g.: SKU for a product page.
19              
20             =cut
21              
22             has attributes => (
23             is => 'ro',
24             isa => HashRef,
25             predicate => 1,
26             );
27              
28             =head2 path
29              
30             Absolute path of the page. This is the only required attribute.
31              
32             =cut
33              
34             has path => (
35             is => 'ro',
36             isa => Str,
37             required => 1,
38             );
39              
40             =head2 query
41              
42             Query parameters as a hash reference.
43              
44             =cut
45              
46             has query => (
47             is => 'ro',
48             isa => HashRef,
49             );
50              
51             =head2 title
52              
53             Page title.
54              
55             =cut
56              
57             has title => (
58             is => 'ro',
59             isa => Str,
60             predicate => 1,
61             );
62              
63             =head1 METHODS
64              
65             =head2 predicates
66              
67             The following predicate methods are defined:
68              
69             =over
70              
71             =item * has_attributes
72              
73             =item * has_title
74              
75             =back
76              
77             =head2 uri
78              
79             Returns the string URI for L and L.
80              
81             =cut
82              
83             sub uri {
84 38     38 1 22595 my $self = shift;
85 38         234 my $uri = URI->new( $self->path );
86 38         12459 $uri->query_form($self->query);
87 38         1699 return $uri->as_string;
88             }
89              
90             1;