sidebar filter
[scpubgit/SCS.git] / lib / SCSite / Page.pm
1 package SCSite::Page;
2
3 use IO::All;
4 use Moo;
5
6 has $_ => (is => 'ro') for qw(title description keywords body created path);
7
8 has "_$_" => (is => 'ro', init_arg => $_) for qw(page_set);
9
10 sub children {
11   my ($self, %args) = @_;
12   if (my $at = delete $args{at_depth}) {
13 warn "Here, $at";
14     @args{qw(min_depth max_depth)} = ($at-1, $at);
15   }
16   my $ps = $self->_page_set;
17   (ref $ps)->new(
18     top_dir => $ps->base_dir,
19     base_dir => io->dir($ps->base_dir)->catdir($self->path),
20     max_depth => 1,
21     %args,
22   );
23 }
24
25 1;