1 package Gruta
::Template
::BASE
;
10 foreach my $p (split(':', $self->{path
})) {
12 while (my $l = readdir D
) {
13 next if -d
$p . '/' . $l;
27 my $template_id = shift;
29 if (not $template_id =~ /^[-\w\d-]+$/) {
30 croak
"Invalid template '$template_id'";
39 my $template_id = shift;
41 $self->_assert($template_id);
45 foreach my $p (split(':', $self->{path
})) {
46 if (open F
, $p . '/'. $template_id) {
47 $content = join('', <F
>);
60 my $template_id = shift;
63 $self->_assert($template_id);
65 # only can be saved on the first directory
66 my ($p) = (split(':', $self->{path
}))[0];
68 open F
, '>' . $p . '/' . $template_id
69 or croak
"Can't write template '${p}/${template_id}'";
79 # create first directory
80 my ($p1) = (split(':', $self->{path
}))[0];