Apache2-PageKit
view release on metacpan or search on metacpan
docsrc/reference.xml view on Meta::CPAN
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
Class method called for every page in the same class which has page code
and/or content. It is called after <literal>pkit_common_code</literal> and before page code.
</para>
<para>
NOTE: currently this is the only pkit_* method which can exist outside Common.pm
</para>
</refsect1>
</refentry>
</sect2>
<sect2 id="model.api.api">
<title>PageKit API</title>
<para>
Theese methods are available to the user as Apache::PageKit::Model API.
</para>
<refentry id="model.api.input">
<refnamediv>
<refname>input</refname>
<refpurpose>
Get request parameters
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<synopsis>
# get single parameter
my $value = $model->input($key);
# get all parameters
my @keys = $model->input;
# set pkit_view request parameter
$model->input(pkit_view => "printable");
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
Gets requested parameter from the Apache request object,
if called without any parameters, gets all available input parameters:
</para>
</refsect1>
</refentry>
<refentry id="model.api.pkit_send">
<refnamediv>
<refname>pkit_send</refname>
<refpurpose>
Can be used to send data to the client.
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<synopsis>
#
# for a filename, the media_type will be found by the <literal>MIME::Types</literal> module.
#
my $status_code = $model->pkit_send($filename);
my $status_code = $model->pkit_send(\$data, 'image/png');
# $data_ref is not zipped by the pkit_send methode, it sends
# it only with this encoding header.
my $status_code = $model->pkit_send($data_ref, 'html/text', 'gzip');
my $status_code = $model->pkit_send($fh);
$model->pkit_status_code($status_code);
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
Can be used to send data to the client. From a scalar_ref a filename or
a reference to a filehandle.
If the first argument is a filename, and the second argument media_type is not set,
the module <literal>MIME::Types</literal>
try to find the media_type for us depending on the suffix.
If this fails or the optional second argument media_type is not set, the default
<literal>application/octet-stream</literal> is used.
If the request was only a head request, only a header is send back to the client.
The optional third argument if the content_encoding (ie: gzip|x-gzip|compress|x-compress) it is only used if the
media_type is html/text.
</para>
</refsect1>
</refentry>
<refentry id="model.api.pkit_component_params_hashref">
<refnamediv>
<refname>pkit_component_params_hashref</refname>
<refpurpose>
Get access to the component parameters.
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<synopsis><![CDATA[
<PKIT_COMPONENT NAME="xxx" headline="title" datasrc="select * from a_table">
<PKIT_COMPONENT NAME="xxx" headline="another_title" datasrc="select * from another_table">
<PKIT_COMPONENT NAME="xxx" headline="title" datasrc="select * from a_table">
sub xxx {
my $model = shift;
my $fields = $model->pkit_component_params_hashref;
my $select_statement = $fields->{DATASRC};
...
}
]]>
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
This method return a hashref that contain the component parameters (or undef if the calling routine is not a component).
All keys are uppercase and the NAME of the component is not present in the hash. If the same component is used twice or more,
( run in 2.045 seconds using v1.01-cache-2.11-cpan-df04353d9ac )