The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

ClearPress::view - MVC view superclass

VERSION

$LastChangedRevision: 12 $

SYNOPSIS

  my $oView = ClearPress::view::<subclass>->new({'util' => $oUtil});
  $oView->model($oModel);

  print $oView->decor()?
    $oDecorator->header()
    :
    q(Content-type: ).$oView->content_type()."\n\n";

  print $oView->render();

  print $oView->decor()?$oDecorator->footer():q();

DESCRIPTION

View superclass for the ClearPress framework

SUBROUTINES/METHODS

new - constructor

  my $oView = ClearPress::view::<subclass>->new({'util' => $oUtil, ...});

template_name - the name of the template to load, based on view class and method_name()

  my $sTemplateName = $oView->template_name();

method_name - the name of the method to invoke on the model, based on action and aspect

  my $sMethodName = $oView->method_name();

add_warning

  $oView->add_warning($sWarningMessage);

authorised - Verify authorisation for this view

  This should usually take into account $self->action() which suggests
  read or write access.

  my $bIsAuthorised = $oView->authorised();

render - generates and returns content for this view

  my $sViewOutput = $oView->render();

list - stub for entity list actions

create - A default model creation/save method

  $oView->create();

  Populates $oSelf->model() with its expected parameters from the CGI
  block, then calls $oModel->create();

add - stub for single-entity-creation actions

edit - stub for single-entity editing

read - stub for single-entity-view actions

update - stub for entity update actions

delete - stub for entity delete actions

tt - a configured Template (TT2) object

  my $tt = $oView->tt();

util - get/set accessor for utility object

  $oView->util($oUtil);
  my $oUtil = $oView->util();

model - get/set accessor for data model object

  $oView->model($oModel);
  my $oModel = $oView->model();

action - get/set accessor for the action being performed on this view

  $oView->action($sAction);
  my $sAction = $oView->action();

aspect - get/set accessor for the aspect being performed on this view

  $oView->aspect($sAction);
  my $sAction = $oView->aspect();

content_type - get/set accessor for content mime-type (Content-Type HTTP header)

  $oView->content_type($sContentType);
  my $sContentType = $oView->content_type();

decor - get/set accessor for page decoration toggle

  $oView->decor($bDecorToggle);
  my $bDecorToggle = $oView->decor();

actions - templated output for available actions

  my $sActionOutput = $oView->actions();

DIAGNOSTICS

CONFIGURATION AND ENVIRONMENT

DEPENDENCIES

Template ClearPress::util Carp English

INCOMPATIBILITIES

BUGS AND LIMITATIONS

AUTHOR

Roger Pettett, <rpettett@cpan.org>

LICENSE AND COPYRIGHT

Copyright (C) 2007 Roger Pettett

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.