package Bookmarks::C::Main; use strict; use base 'Catalyst::Base'; =head1 NAME Bookmarks::C::Main - Catalyst component =head1 SYNOPSIS See L =head1 DESCRIPTION Catalyst component. =head1 METHODS =over 4 =item default =cut sub tags : Global { my ( $self, $c ) = @_; $c->stash->{template}='tags'; $c->stash->{tags}=[Bookmarks::M::DB::Tags->get_all_tags_by_popularity()]; } sub tag : Regex('^tag/(.*)$') { my ( $self, $c ) = @_; my $tagname=$c->req->snippets->[0]; my ($tag)=Bookmarks::M::DB::Tags->search({name=>$tagname}); if (!defined $tag) { $c->stash->{tagname}=$tagname; $c->stash->{template}='notag'; } else { my @links=$tag->ordered_links(); $c->stash->{tag}=$tag; $c->stash->{links}=[@links]; $c->stash->{template}='links'; } } sub icon : Global { my ( $self, $c ) = @_; my $link=Bookmarks::M::DB::Links->retrieve($c->req->param('link')); if ($link->icon()) { $c->res->content_type('image/x-icon'); $c->res->body($link->icon()); } else { $c->res->status(404); $c->res->body('nonce'); } } =back =head1 AUTHOR A clever guy =head1 LICENSE This library is free software . You can redistribute it and/or modify it under the same terms as perl itself. =cut 1;