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

Name

CatalystX::Usul::Model - Interface model base class

Version

0.7.$Revision: 1181 $

Synopsis

   package CatalystX::Usul;
   use parent qw(CatalystX::Usul::Base CatalystX::Usul::File);

   package CatalystX::Usul::Model;
   use parent qw(Catalyst::Model CatalystX::Usul CatalystX::Usul::IPC);

   package YourApp::Model::YourModel;
   use parent qw(CatalystX::Usul::Model);

Description

Common core interface model methods

Subroutines/Methods

COMPONENT

Defines the following accessors:

scrubbing

Boolean used by "query_array" and "query_value" to determine if input value should be cleaned of potentially dangerous characters

scrub_chars

List of characters to scrub from input values. Defaults to '"/\;

Loads model plugins including;

CatalystX::Usul::Plugin::Model::StashHelper

ACCEPT_CONTEXT

Calls "build_per_context_instance" for each new context

build_per_context_instance

Called by "ACCEPT_CONTEXT". Takes a copy of the Catalyst object so that we don't have to pass $c->stash into "loc" in CatalystX::Usul

check_field

   $self->check_field( $id, $val );

Expose "check_field" in Data::Validation

check_form

   $self->check_form( \%fields );

Expose "check_form" in Data::Validation

form

   $self->form( @rest );

Calls the form method to stuff the stash with the data for the requested form. Uses the $c->stash->{form}->{name} value to construct the method name

loc

   $local_text = $self->loc( $key, $args );

Localizes the message. Calls "loc" in CatalystX::Usul

query_array

   $array_ref = $self->query_array( $attr );

Returns the requested parameter in a list context. Uses the encoding attribute to generate the method call to decode the input values. The decode method is provided by CatalystX::Usul::Encoding. Will try to guess the encoding if one is not provided

query_value

   $scalar_value = $self->query_value( $attr );

Returns the requested parameter in a scalar context. Uses encoding attribute to generate the method call to decode the input value. The decode method is provided by CatalystX::Usul::Encoding. Will try to guess the encoding if one is not provided

query_value_by_fields

   $hash_ref = $self->query_value_by_fields( @fields );

Returns a hash_ref of fields and their values if the values are defined by the request. Calls "query_value" for each of supplied fields

scrub

   $value = $self->scrub( $value );

Removes the $self->scrub_chars from the value

_get_req_array

   my $array_ref = $self->_get_req_array( $attr );

Takes a request object that must implement a params method which returns a hash ref. The method returns the value for $attr from that hash. This method will always return a array ref. This method is wrapped by "mk_encoding_methods" in Catalystx::Usul::Encoding and as such is not called directly

_get_req_value

   my $value = $self->_get_req_value( $attr );

Takes a request object that must implement a params method which returns a hash ref. The method returns the value for $attr from that hash. This method will always return a scalar. This method is wrapped by "mk_encoding_methods" in Catalystx::Usul::Encoding and as such is not called directly

Configuration and Environment

None

Diagnostics

None

Dependencies

Catalyst::Model
CatalystX::Usul
CatalystX::Usul::Encoding
CatalystX::Usul::IPC
Data::Validation
Scalar::Util

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) 2008-2009 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