Gantry::Stash - Main stash object for Gantry


Gantry documentation Contained in the Gantry distribution.

Index


Code Index:

NAME

Top

Gantry::Stash - Main stash object for Gantry

SYNOPSIS

Top

This object is created for you by the handler in the base module.

DESCRIPTION

Top

Use this module to store and retrieve things in the stash (which is good for one web page hit). Example:

    $self->stash->view->title( 'Browser Title Bar Text Here' );

METHODS

Top

new
    Makes a new empty stash object.  Don't try to pass it anything.

view
    Returns the 'view' stash object

controller
    Returns the 'controller' stash object

MODULES

Top

Gantry::Stash::View
Gantry::Stash::Controller

SEE ALSO

Top

Gantry, Gantry::Stash::View, Gantry::Stash::Controller

LIMITATIONS

Top

AUTHOR

Top

Phil Crow <pcrow@sunflowerbroadband.com>

Tim Keefer <tkeefer@gmail.com>

COPYRIGHT and LICENSE

Top


Gantry documentation Contained in the Gantry distribution.

package Gantry::Stash;
package stash;

use strict;

use Gantry::Stash::View;
use Gantry::Stash::Controller;

#-------------------------------------------------
# AUTOLOAD
#-------------------------------------------------
sub AUTOLOAD {
    my $self    = shift;
    my $command = our $AUTOLOAD;
    $command    =~ s/.*://;

    die( "Undefined stash method: $command" );

} # end AUTOLOAD

#-------------------------------------------------
# DESTROY
#-------------------------------------------------
sub DESTROY { }

#-------------------------------------------------
# new
#-------------------------------------------------
sub new {
    my $class = shift;
    my $self  = bless( {}, $class );
    return $self;

} # end new

#-------------------------------------------------
# view
#-------------------------------------------------
sub view {
    my $self = shift;

    $self->{__VIEW__} = view->new() unless defined $self->{__VIEW__};

    return $self->{__VIEW__};

} # end view

#-------------------------------------------------
# controller
#-------------------------------------------------
sub controller {
    my $self = shift;

    $self->{__CONTROLLER__} = controller->new() 
        unless defined $self->{__CONTROLLER__};

    return $self->{__CONTROLLER__};

} # end controller

1;

__END__