Bootylicious

 view release on metacpan or  search on metacpan

lib/Bootylicious/Comment.pm  view on Meta::CPAN

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
    my %params = @_;
 
    foreach my $method (qw/author email url content/) {
        $self->$method($params{$method}) if defined $params{$method};
    }
 
    return $self;
}
 
sub created {
    Bootylicious::Timestamp->new(epoch => stat(shift->path)->mtime);
}
sub email { shift->metadata(email => @_) }
sub url   { shift->metadata(url   =>) }
 
sub content { shift->inner(content => @_) }
 
sub number {
    my $self = shift;
 
    my $path = $self->path;

lib/Bootylicious/Document.pm  view on Meta::CPAN

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
    my $self = shift;
    my $path = shift;
 
    return unless -e $path;
 
    $self->path($path);
 
    return $self;
}
 
sub name     { shift->stat(name     => @_) }
sub format   { shift->stat(format   => @_) }
sub filename { shift->stat(filename => @_) }
sub created  { shift->stat(created  => @_) }
sub modified { shift->stat(modified => @_) }
 
sub author { shift->metadata(author => @_) }
 
sub content { shift->inner(content => @_) }
 
sub stat     { shift->_group(stat     => @_) }
sub metadata { shift->_group(metadata => @_) }
sub inner    { shift->_group(inner    => @_) }
 
sub _group {

lib/Bootylicious/DocumentStatLoader.pm  view on Meta::CPAN

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
    Carp::croak qq/Bad file $path/ unless $name && $format;
 
    my $filename = join '.' => $name, $format;
 
    my $created;
    if ($name =~ s/^($TIMESTAMP_RE)-//) {
        $created = Bootylicious::Timestamp->new(timestamp => $1)->epoch;
        return unless defined $created;
    }
 
    my $modified = stat($path)->mtime;
    $created ||= $modified;
 
    return {
        name     => $name,
        filename => $filename,
        format   => $format,
        created  => Bootylicious::Timestamp->new(epoch => $created),
        modified => Bootylicious::Timestamp->new(epoch => $modified)
    };
}

lib/Bootylicious/Plugin/PageCache.pm  view on Meta::CPAN

52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
    return unless my $booty = $c->stash('booty');
 
    my $last_modified = $booty->modified->epoch;
    return unless $last_modified;
 
    my $path = _cache_path($c, $conf->{root});
    my $file = _cache_file($c, $path);
    return unless $file;
 
    if (-r $file && stat($file)->mtime >= $last_modified) {
        $c->app->log->debug('Serving cached version');
        return $c->render_static($path);
    }
 
    $c->stash(page_cache => 1);
 
    return;
}
 
sub _cache_response {



( run in 0.593 second using v1.01-cache-2.11-cpan-49f99fa48dc )