domain support for feeds, factor out sc-specific bits
[scpubgit/SCS.git] / lib / SCSite / Page.pm
CommitLineData
ebd4c292 1package SCSite::Page;
2
3use IO::All;
2a19b2a6 4use Time::Local qw(timelocal);
ebd4c292 5use Moo;
6
cbb06a72 7with 'SCSite::PageChildren';
8
2a19b2a6 9has $_ => (is => 'ro') for qw(
10 title subtitle description keywords body created path
11);
12
13sub 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 21has "_$_" => (is => 'ro', init_arg => $_) for qw(page_set);
ebd4c292 22
cbb06a72 23sub _page_set_class { ref($_[0]->_page_set) }
24sub _top_dir { $_[0]->_page_set->top_dir }
25sub _my_path { io->dir($_[0]->_top_dir)->catdir($_[0]->path) }
ebd4c292 26
271;