Commit | Line | Data |
ebd4c292 |
1 | package SCSite::Page; |
2 | |
3 | use IO::All; |
2a19b2a6 |
4 | use Time::Local qw(timelocal); |
ebd4c292 |
5 | use Moo; |
6 | |
cbb06a72 |
7 | with 'SCSite::PageChildren'; |
8 | |
2a19b2a6 |
9 | has $_ => (is => 'ro') for qw( |
10 | title subtitle description keywords body created path |
11 | ); |
12 | |
13 | sub published_at { |
14 | $_[0]->created |
15 | ? scalar localtime timelocal |
16 | map +(@{$_}[0..3], $_->[4]-1, $_->[5]-1900), |
17 | [ reverse split '\D+', $_[0]->created ] |
18 | : '' |
19 | } |
ebd4c292 |
20 | |
34597fb2 |
21 | has "_$_" => (is => 'ro', init_arg => $_) for qw(page_set); |
ebd4c292 |
22 | |
cbb06a72 |
23 | sub _page_set_class { ref($_[0]->_page_set) } |
24 | sub _top_dir { $_[0]->_page_set->top_dir } |
25 | sub _my_path { io->dir($_[0]->_top_dir)->catdir($_[0]->path) } |
ebd4c292 |
26 | |
27 | 1; |