CatalystX::Usul::QueryRequest - Create request query methods for different encodings
Describes v0.17.$Rev: 1 $
use qw(CatalystX::Usul::QueryRequest);
Creates a pair of methods (one for scalar values and one for array refs) for each of the encodings specified in the encodings attribute
Defines the following accessors:
An encoding type which is required
Array ref which defaults to [ qw(ascii iso-8859-1 UTF-8 guess) ]
[ qw(ascii iso-8859-1 UTF-8 guess) ]
A weakened request object reference. This is a writable attribute
Boolean used by "query_array" and "query_value" to determine if input value should be cleaned of potentially dangerous characters
List of characters to scrub from input values. Defaults to '"/\;. Can also be a coderef in which case it is called with the input value and it's return value is used
Create the request query methods
$array_ref = $self->query_array( $attr );
Uses the encoding attribute to generate the method call to decode the input values. Will try to guess the encoding if one is not provided
If the form attribute _${attr}_nrows is not defined then this method returns an array ref of the the form attributes. If the _${attr}_nrows is defined then this method returns an array ref of selected values from the select checkbox column of the table widget
$hash_ref = $self->query_hash( $attr, \@fields );
Returns a hash ref of data extracted from the table embeded in a form
$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. Will try to guess the encoding if one is not provided
$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
$array_ref = $self->_decode_data( $encoding, $array_ref ); $value = $self->_decode_data( $encoding, $value );
Decodes the data passed using the given encoding name. Can handle both scalars and array refs but not hashes
$array_ref = $self->_get_req_array( $attr );
Uses the request attribute 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
params
$attr
$value = $self->_get_req_value( $attr );
Uses the request attribute 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
$value = $self->_guess_encoding( $req_method, $attr );
If you really don't know what the source encoding is then this method will use Encode::Guess to determine the encoding. If successful calls "_decode_data" to get the job done
$value = $self->_scrub( $value );
Removes the $self->scrubbing from the value
$self->scrubbing
$name = __method_name( $encoding );
Takes an encoding name and converts it to a private method name
None
There are no known incompatibilities in this module
There are no known bugs in this module. Please report problems to the address below. Patches are welcome
Peter Flanigan, <Support at RoxSoft.co.uk>
<Support at RoxSoft.co.uk>
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
To install CatalystX::Usul, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CatalystX::Usul
CPAN shell
perl -MCPAN -e shell install CatalystX::Usul
For more information on module installation, please visit the detailed CPAN module installation guide.