/usr/share/perl5/Perlanet/Trait/TemplateToolkit.pm is in libperlanet-perl 0.56-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | package Perlanet::Trait::TemplateToolkit;
use strict;
use warnings;
use Moose::Role;
use namespace::autoclean;
=head1 NAME
Perlanet::Trait::TemplateToolkit - render the feed via a Template Toolkit
template
=head1 SYNOPSIS
my $perlanet = Perlanet->new_with_traits(
traits => [ 'Perlanet::Trait::TemplateToolkit' ]
);
$perlanet->run;
=head1 DESCRIPTION
Renders the aggregated set of feeds via a Template Toolkit template.
=head1 ATTRIBUTES
=head2 template_input
The Template Toolkit template to use as input
=head2 template_output
The path to save the resulting output to
=head1 TEMPLATE TOOLKIT STASH
The following are exported into your template:
=head2 feed
A L<Perlanet::Feed> that represents the aggregation of all posts
=cut
use Template;
use Carp;
has 'page' => (
isa => 'HashRef',
is => 'rw',
default => sub {
{ file => 'index.html', template => 'index.tt' }
},
);
after 'render' => sub {
my ($self, $feed) = @_;
my $tt = Template->new;
$tt->process(
$self->page->{template},
{
feed => $feed,
cfg => $self,
},
$self->page->{file},
{
binmode => ':utf8'
}
) or croak $tt->error;
};
=head1 AUTHOR
Oliver Charles, <oliver.g.charles@googlemail.com>
=head1 COPYRIGHT AND LICENSE
Copyright (c) 2010 by Magnum Solutions Ltd.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.10.0 or,
at your option, any later version of Perl 5 you may have available.
=cut
1;
|