ClearPress::view - MVC view superclass
$LastChangedRevision: 300 $
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();
View superclass for the ClearPress framework
my $oView = ClearPress::view::<subclass>->new({util => $oUtil, ...});
sets the aspect based on the HTTP Accept: header - useful for API access setting Accept: text/xml
my $sTemplateName = $oView->template_name();
my $sMethodName = $oView->method_name();
$oView->add_warning($sWarningMessage);
my $arWarningStrings = $oView->warnings();
This should usually take into account $self->action() which suggests read or write access. my $bIsAuthorised = $oView->authorised();
my $sViewOutput = $oView->render();
$oView->create(); Populates $oSelf->model() with its expected parameters from the CGI block, then calls $oModel->create();
my $tt = $oView->tt();
$oView->util($oUtil); my $oUtil = $oView->util();
$oView->model($oModel); my $oModel = $oView->model();
$oView->action($sAction); my $sAction = $oView->action();
$oView->aspect($sAction); my $sAction = $oView->aspect();
$oView->content_type($sContentType); my $sContentType = $oView->content_type();
$oView->decor($bDecorToggle); my $bDecorToggle = $oView->decor();
Usually set by the controller, after processing the request. Used for remapping requests to classes (specifically things of the form application::(model|view)::something::somethingelse . $oView->entity_name($sEntityName); my $sEntityName = $oView->entity_name();
my $sActionOutput = $oView->actions();
Based on HTTP headers, environment variables and URL components.
Process template.tt2 with standard parameters, output to stdout. $oView->process_template('template.tt2'); Process template.tt2 with standard parameters plus extras, output to stdout. $oView->process_template('template.tt2', {extra=>'params'}); Process template.tt2 with standard plus extra parameters and output into $to_scalar. $oView->process_template('template.tt2', {extra=>'params'}, $to_scalar);
$oView->output_buffer(q[my string]); $oView->output_buffer(@aStrings);
$oView->output_end();
$oView->output_finished(1); $oViwe->output_finished(0);
$oView->output_flush();
$oView->output_reset();
If you're producing applications of moderate complexity, you almost certainly want to disable autoescaping and handle it more cleverly yourself. Subclass ClearPress::view and set self->autoescape to zero or override the subroutine: sub autoescape { return 0; }
Roger Pettett, <rpettett@cpan.org>
Copyright (C) 2008 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.
To install ClearPress, copy and paste the appropriate command in to your terminal.
cpanm
cpanm ClearPress
CPAN shell
perl -MCPAN -e shell install ClearPress
For more information on module installation, please visit the detailed CPAN module installation guide.