NAME
Template::Pure::Components - Reusable HTML components
SYNOPSIS
package Local::Timestamp;
use Moo;
use DateTime;
extends 'Template::Pure::Component';
has 'tz' => (is=>'ro', predicate=>'has_tz');
sub style {q[
.timestamp {
color: blue;
}
]}
sub script {q[
function hello() {
alert('Hi');
}
]}
sub template {
q[<span class='timestamp' onclick="hello()">time</span>];
}
sub directives {
'.timestamp' => 'self.time',
}
sub time {
my ($self) = @_;
my $now = DateTime->now;
$now->set_time_zone($self->tz)
if $self->has_tz;
return $now;
}
DESCRIPTION
Work in progress. Play here only if you are willing to get you hands dirty and have stuff break.
SEE ALSO
AUTHOR
John Napiorkowski L<email:jjnapiork@cpan.org>
But lots of this code was copied from Template::Filters and other prior art on CPAN. Thanks!
COPYRIGHT & LICENSE
Please see Template::Pure for copyright and license information.