NAME
Thorny::Tumblr - Catalyst Utility for Tumblr
DESCRIPTION
This class is a Tumblr utility class for Perl Catalyst.
Try the following in a Perl Catalyst class based on Tumblr:
use base 'Catalyst::Model::Adaptor'; __PACKAGE__->config(class => 'SpeedDateCanada::Util::Tumblr', args => { tag => 'content_hashtag', type => 'photo' });
Here's an example of the root page :
sub index :Path :Args(0) { my ( $self, $c) = @_;
# create an instance of the Tumblr util
my $jumbotrons = $c->model('Site::Jumbotrons')->get_tagged_posts;
my $events = $c->model('Site::Events')->get_tagged_posts;
my $testimonials = $c->model('Site::Testimonials')->get_tagged_posts;
my $questions = $c->model('Site::Questions')->get_tagged_posts;
my $abouts = $c->model('Site::Abouts')->get_tagged_posts;
my @blockquotes = shuffle(@{$testimonials});
my @stripped_blockquotes;
my $hs = HTML::Strip->new();
for my $bq (@blockquotes) {
push @stripped_blockquotes, { voice => $hs->parse($bq->{text}),handle => $hs->parse($bq->{source}) };
}
my $stripped_blockquotes_ref = \@stripped_blockquotes;
# root page from template toolkit
$c->stash(template => 'root.tt', jumbotrons => $jumbotrons, blockquotes => $stripped_blockquotes_ref, events => $events, questions => $questions, abouts => $abouts);
}
AUTHOR
Jason McVeigh
LICENSE
This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.