Perldoc::Server::Controller::Functions - Catalyst Controller


Perldoc-Server documentation Contained in the Perldoc-Server distribution.

Index


Code Index:

NAME

Top

Perldoc::Server::Controller::Functions - Catalyst Controller

DESCRIPTION

Top

Catalyst Controller.

METHODS

Top

index

AUTHOR

Top

Jon Allen

LICENSE

Top

This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.


Perldoc-Server documentation Contained in the Perldoc-Server distribution.
package Perldoc::Server::Controller::Functions;

use strict;
use warnings;
use parent 'Catalyst::Controller';

sub index :Path :Args(0) {
  my ( $self, $c ) = @_;

  $c->response->redirect( $c->uri_for('/index/functions') );
}


sub view :Path :Args(1) {
  my ($self, $c, $function) = @_;

  # Count the page views in the user's session
  my $uri = "/functions/$function";
  $c->session->{counter}{$uri}{count}++;
  $c->session->{counter}{$uri}{name} = $function;
  
  $c->stash->{title}         = $function;
  $c->stash->{pod}           = $c->model('PerlFunc')->pod($function);
  $c->stash->{breadcrumbs}   = [ {url=>$c->uri_for('/index/functions'), name=>'Functions'} ];
  $c->stash->{page_template} = 'function.tt';
  $c->stash->{contentpage}   = 1;
  
  $c->forward('View::Pod2HTML');
}

1;