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

Name

CatalystX::Usul::View - Base class for views

Version

Describes v0.16.$Rev: 1 $

Synopsis

   package YourApp::View::HTML;

   use CatalystX::Usul::Moose;

   extends qw(CatalystX::Usul::View::HTML);


   package YourApp::View::JSON;

   use CatalystX::Usul::Moose;

   extends qw(CatalystX::Usul::View::JSON);

Description

Provide common methods for view component subclasses

Subroutines/Methods

COMPONENT

The constructor stores a copy of the application instance for future reference. It does this to remain compatible with Catalyst::Controller whose constructor is no longer called

bad_request

Sets the response body to the provided error message and the response status to 400

deserialize

Calls the deserialization method selected by the subclass on the request body

get_verb

Returns the lower case request method name. Allows for the implementation of a "RESTful" API. The client may post and set the _method request parameter to delete or put if it does not support those methods directly. It may also set the the _method to an arbitrary value

The verb is used by the action class to lookup the action to forward to. Called from the begin method once the current view has been determined from the request content type

loc

   $localized_text = $self->loc( $c->stash, $key, @options );

Localizes the message. Calls "localize" in Class::Usul::L10N. Adds the constant DEFAULT_L10N_DOMAINS to the list of domain files that are searched. Adds $c->stash->{language} and $c->stash->{namespace} (search domain) to the arguments passed to localize

not_implemented

Sets the response body to the provided error message and the response status to 405

prepare_data

   $hash_ref = $self->prepare_data( $c );

Called by "process" this method is responsible for selecting those elements from the stash that are passed to the serializer method

process

Serializes the response using XML::Simple and encodes the body using Encode if required

read_form_sources

Returns an array ref widget references in the stash. Can be passed to "_build_widgets" or its output can be sent directly to the serializer

Private Methods

_build_widgets

Calls build in HTML::FormWidgets which transforms the widgets definitions into fragments of HTML or XHTML as required

Diagnostics

None

Configuration and Environment

None

Dependencies

Catalyst::View
Class::Usul
CatalystX::Usul::Moose
Encode
CatalystX::Usul::Constraints
HTML::FormWidgets
Template
TryCatch

Incompatibilities

There are no known incompatibilities in this module

Bugs and Limitations

There are no known bugs in this module. Please report problems to the address below. Patches are welcome

Author

Peter Flanigan, <Support at RoxSoft.co.uk>

License and Copyright

Copyright (c) 2014 Peter Flanigan. All rights reserved

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic

This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE