Apache2-PageKit
view release on metacpan or search on metacpan
the param was not defined. Older PageKits returned undef
( Boris Zentner )
- Fix: add missing : in binmode $fh, ":encoding(...)";
( Boris Zentner )
- Fix: typo in scripts/pkit_rename_app.pl ( Boris Zentner )
1.15
- Add: request_class parameter just for the case, that you like
another class or subclass do what Apache::Request do for
you. Defaults to Apache::Request::PageKit
( Boris Zentner )
- Fix: conversion error if the tmpl file's encoding is != utf8
and no content_var's are used. affects only perl < 5.8.0
( Boris Zentner )
- Add: Basic testsuite ( Boris Zentner )
- Remove setup_eg.pl this file is obsolete ( Boris Zentner )
- Fix: Fresh created session cookie headers are wrongly not send
for pkit_redirect pages this is fixed now. ( Boris Zentner )
- Add: Experimental support for Template Toolkit. Enabled with
template_class = "Template" in your Config.xml
( Boris Zentner)
- Fix: with pkit_admin=on and perl 5.8.x the input data is
docsrc/reference.xml view on Meta::CPAN
</refentry>
<refentry id="model.api.output_convert">
<refnamediv>
<refname>output_convert</refname>
<refpurpose>
Outputs data for display, converting charset.
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<synopsis>
$model->output_convert(output => {foo => $utf8_text},
input_charset => 'UTF-8');
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
This is a wrapper to the <link linkend="model.api.output">output</link>
method. It converts the output from the character set specified by
the charset argument to <link linkend="config.global.default_output_charset">default_output_charset</link>. If the character set is not specified, then
<link linkend="config.global.default_input_charset">default_input_charset</link> is used.
</para>
</refsect1>
<refsect1>
<title>Examples</title>
<informalexample>
<programlisting>
# converts from UTF-8
$model->output_convert(output => { key => $utf8_text },
charset => 'UTF-8');
# converts from default_input_charset
$model->output_convert(key => $text)
</programlisting>
</informalexample>
</refsect1>
</refentry>
<refentry id="model.api.output">
<refnamediv>
<refname>output</refname>
lib/Apache2/PageKit.pm view on Meta::CPAN
}
}
}
}
1;
package Apache2::PageKit;
# $Id: PageKit.pm,v 1.236 2004/05/06 09:54:35 borisz Exp $
# require perl 5.8 for numerous utf8 issues ( and Encode )
require 5.008;
use strict;
# CPAN Modules required for pagekit
use mod_perl2 1.9921;
use Apache2::URI ();
use Apache2::Cookie ();
use Apache2::Request ();
use Apache::SessionX ();
lib/Apache2/PageKit/Model.pm view on Meta::CPAN
return @list;
} else {
return $model->{pkit_pk}->{apr}->param(@_);
}
}
sub fillinform {
my $model = shift;
my @params = @_;
for ( @params ) {
Encode::_utf8_off( $_ ) unless ref $_;
}
return $model->{pkit_pk}->{fillinform_object}->param(@params);
}
sub ignore_fillinform_fields {
my $model = shift;
push @{$model->{pkit_pk}->{ignore_fillinform_fields}}, @_;
}
sub output {
lib/Apache2/PageKit/View.pm view on Meta::CPAN
}
my $output = $tmpl->output;
if($record->{has_form}){
# if fillinform_objects is set, then we use that to fill in any HTML
# forms in the template.
my $fif;
if(@{$view->{fillinform_objects}}){
$view->{pkit_pk}->{browser_cache} = 'no';
Encode::_utf8_off($output);
$fif = HTML::FillInForm->new();
$output = $fif->fill(scalarref => \$output,
fobject => $view->{fillinform_objects},
ignore_fields => $view->{ignore_fillinform_fields}
);
Encode::_utf8_on($output);
}
}
if($view->{can_edit} eq 'yes'){
$view->{pkit_pk}->{browser_cache} = 'no';
Apache2::PageKit::Edit::add_edit_links($view, $record, \$output);
}
return \$output;
}
# gets static gzipped file, creating it if necessary
lib/Apache2/PageKit/View.pm view on Meta::CPAN
my $output = Template::Context->new->process(Template::Document->new( $record->{filtered_html} ), \%tt_params );
if ( $record->{has_form} ) {
# if fillinform_objects is set, then we use that to fill in any HTML
# forms in the template.
my $fif;
if ( @{ $view->{fillinform_objects} } ) {
$view->{pkit_pk}->{browser_cache} = 'no';
Encode::_utf8_off($output);
$fif = HTML::FillInForm->new();
$output = $fif->fill(
scalarref => \$output,
fobject => $view->{fillinform_objects},
ignore_fields => $view->{ignore_fillinform_fields}
);
Encode::_utf8_on($output);
}
}
if ( $view->{can_edit} eq 'yes' ) {
$view->{pkit_pk}->{browser_cache} = 'no';
Apache2::PageKit::Edit::add_edit_links( $view, $record, \$output );
}
return \$output;
}
######################################################
t/03_charset.t view on Meta::CPAN
# preform the test twice, the first time to fill the cache and a
# second time to use the results.
for ( 1 .. 2 ) {
my $data = GET_BODY $url, 'Accept-Charset', 'iso-8859-1';
ok t_cmp( $data, qr~$s1~, "street ok? (iso-8859-1)" );
ok t_cmp( $data, qr~$s2~, "street from content_var ok? (iso-8859-1)" );
}
for ( 1 .. 2 ) {
my $data = GET_BODY $url, 'Accept-Charset', 'utf8';
unless ( $] < 5.008 ) {
Encode::from_to( $data, utf8 => 'iso-8859-1' );
}
else {
my $c = Text::Iconv->new( utf8 => "iso-8859-1");
$data = $c->convert( $data );
}
ok t_cmp( $data, qr~$s1~, "street ok? (utf8)" );
ok t_cmp( $data, qr~$s2~, "street from content_var ok? (utf8)" );
}
t/09_charset_tmpl.t view on Meta::CPAN
my $s1 = 'index.tmpl: straße straße ööäöüäüöüü';
# preform the test twice, the first time to fill the cache and a
# second time to use the results.
for ( 1 .. 2 ) {
my $data = GET_BODY $url, 'Accept-Charset', 'iso-8859-1';
ok t_cmp( $data, qr~$s1~, "street ok? (iso-8859-1)" );
}
for ( 1 .. 2 ) {
my $data = GET_BODY $url, 'Accept-Charset', 'utf8';
unless ( $] < 5.008 ) {
Encode::from_to( $data, utf8 => 'iso-8859-1' );
}
else {
my $c = Text::Iconv->new( utf8 => "iso-8859-1");
$data = $c->convert( $data );
}
ok t_cmp( $data, qr~$s1~, "street ok? (utf8)" );
}
( run in 1.719 second using v1.01-cache-2.11-cpan-49f99fa48dc )