--- /dev/null
+package Newslash::Plugin::Epoch;
+use Mojo::Base 'Mojolicious::Plugin';
+use Time::HiRes qw(time);
+
+sub register {
+ my ($self, $app, $conf) = @_;
+
+ $self->update;
+ $app->helper(epoch => sub { state $epoch = $self; });
+
+ $app->renderer_helper->add_function("Newslash", epoch => sub { return $self->get });
+}
+
+sub get {
+ return shift->{epoch};
+}
+
+sub update {
+ my $raw_epoch = time;
+ $raw_epoch =~ s/\.//;
+ return shift->{epoch} = $raw_epoch;
+}
+
+1;
+
+=encoding utf8
+
+=head1 NAME
+
+Newslash::Plugin::Epoch - Epoch counter plugin
+
+=head1 SYNOPSIS
+
+ # Mojolicious
+ $app->plugin('Newslash::Plugin::Epoch');
+
+=head1 DESCRIPTION
+
+L<Newslash::Plugin::Epoch> porvides global Epoch counter.
+
+Epoch is similar to version or revision, but updatable while Newslash
+is under operating.
+
+
+=head1 METHODS
+
+=head2 register
+
+ $plugin->register(Mojolicious->new);
+
+Register epoch in L<Mojolicious> application.
+
+=head2 get
+
+ $app->epoch->get;
+
+Return epoch value.
+
+=head2 update
+
+ $app->epoch->update;
+
+Update epoch value.
+
+=head1 SEE ALSO
+
+L<Mojolicious>, L<Mojolicious::Guides>, L<http://mojolicious.org>.
+
+=cut
# stash for plugins
#$app->config->{_Plugins} = {};
+ # use Epoch
+ $app->plugin('Newslash::Plugin::Epoch');
+
# use BasicAuth?
if ($app->config->{BasicAuth} && $app->config->{BasicAuth}->{enable}) {
$app->plugin('Newslash::Plugin::BasicAuth');