X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FSCSite%2FPage.pm;h=028483eaa7f9a16729df6cc36a22071e5e675f52;hb=cbb06a720cd579a1754fc772ee4ce73cd99d921b;hp=7d0962775a617eb393f53931b0f56b5aad108d99;hpb=0fb543cdf1fbd8edf05c4020b853ee4ae73c72b6;p=scpubgit%2FSCS.git diff --git a/lib/SCSite/Page.pm b/lib/SCSite/Page.pm index 7d09627..028483e 100644 --- a/lib/SCSite/Page.pm +++ b/lib/SCSite/Page.pm @@ -4,6 +4,8 @@ use IO::All; use Time::Local qw(timelocal); use Moo; +with 'SCSite::PageChildren'; + has $_ => (is => 'ro') for qw( title subtitle description keywords body created path ); @@ -18,18 +20,8 @@ sub published_at { has "_$_" => (is => 'ro', init_arg => $_) for qw(page_set); -sub children { - my ($self, %args) = @_; - if (my $at = delete $args{at_depth}) { - @args{qw(min_depth max_depth)} = ($at, $at); - } - my $ps = $self->_page_set; - (ref $ps)->new( - top_dir => $ps->base_dir, - base_dir => io->dir($ps->base_dir)->catdir($self->path), - max_depth => 1, - %args, - ); -} +sub _page_set_class { ref($_[0]->_page_set) } +sub _top_dir { $_[0]->_page_set->top_dir } +sub _my_path { io->dir($_[0]->_top_dir)->catdir($_[0]->path) } 1;