Apache-PageKit
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
my $t = shift->SUPER::tools_other(@_);
$t .= "PATCH = patch\n";
$t .= "PERLRUN_VERSION_GE_58 = " . ( $] >= 5.008 ) . "\n";
$t;
}
sub top_targets {
my $t = shift->SUPER::top_targets(@_);
if ( $] >= 5.008 ) {
$t =~ s!pure_all :: config pm_to_blib!pure_all :: config patch_blib!;
}
$t;
}
1;
#
# write the diff. so it can be easy removed from cvs one day.
#
package main;
open FH, ">patch_file.diff" || die $!;
print FH <<'__THIS_IS_THE_END__';
diff -Nur a/lib/Apache/PageKit/Content.pm b/lib/Apache/PageKit/Content.pm
--- a/lib/Apache/PageKit/Content.pm 2005-01-01 20:42:57.099137592 +0100
+++ b/lib/Apache/PageKit/Content.pm 2005-01-01 19:33:16.000000000 +0100
@@ -103,8 +103,7 @@
# this pattern is not very accurate, but only as quick check if a run of XPathTemplate is needed
my $content_pattern = ( $content->{relaxed_parser} eq 'yes' ) ? '<(?:!--)?\s*CONTENT_(VAR|LOOP|IF|UNLESS)\s+' : '<CONTENT_(VAR|LOOP|IF|UNLESS)\s+';
- my $skip_xpath_content = $$template_ref =~ m!$content_pattern!i;
- if( $skip_xpath_content ){
+ if($$template_ref =~ m!$content_pattern!i){
# XPathTemplate template
my $xpt = HTML::Template::XPath->new( default_lang => $content->{default_lang},
@@ -126,7 +125,7 @@
} else {
$lang_tmpl->{$content->{default_lang}} = $template_ref;
}
- return wantarray ? ( $lang_tmpl, $skip_xpath_content ) : $lang_tmpl;
+ return $lang_tmpl;
}
sub _rel2abs {
diff -Nur a/lib/Apache/PageKit/Edit.pm b/lib/Apache/PageKit/Edit.pm
--- a/lib/Apache/PageKit/Edit.pm 2005-01-01 20:42:57.117134856 +0100
+++ b/lib/Apache/PageKit/Edit.pm 2005-01-01 19:33:16.000000000 +0100
@@ -44,14 +44,15 @@
$model->output( read_only => 1 ) if ( ! -w $file );
- open FILE, "$file" or die $!;
- binmode FILE;
- local $/ = undef;
+ my $default_input_charset = $model->{pkit_pk}->{view}->{default_input_charset};
+ open my $fh, $file or die $!;
+ binmode $fh, ":encoding($default_input_charset)";
+ local $/;
# we need to escape HTML tags to avoid </textarea>
# my $content = Apache::Util::escape_html(<PAGE> || "");
- my $content = <FILE>;
- close FILE;
+ my $content = <$fh>;
+ close $fh;
# we need to escape all & chars so that for example is
# and not ' '
@@ -76,10 +77,11 @@
my $pkit_done = $model->input('pkit_done');
my $content = $model->input('content');
- open FILE, ">$file" or die $!;
- binmode FILE;
- print FILE $content;
- close FILE;
+ my $default_input_charset = $model->{pkit_pk}->{view}->{default_input_charset};
+ open my $fh, ">$file" or die $!;
+ binmode $fh, ":encoding($default_input_charset)";
+ print $fh $content;
+ close $fh;
if($pkit_done){
$model->pkit_redirect($pkit_done);
diff -Nur a/lib/Apache/PageKit/Model.pm b/lib/Apache/PageKit/Model.pm
--- a/lib/Apache/PageKit/Model.pm 2005-01-01 20:42:57.138131664 +0100
+++ b/lib/Apache/PageKit/Model.pm 2005-01-01 19:33:16.000000000 +0100
@@ -204,15 +204,8 @@
# translate from default_input_charset to default_output_charset if needed
my $view = $model->{pkit_pk}->{view};
my $input_charset = $view->{default_input_charset};
- my $default_output_charset = $view->{default_output_charset};
- if ($input_charset ne $default_output_charset) {
- my $converter = eval { Text::Iconv->new($input_charset, $default_output_charset) };
- if ($@) {
- die "Charset $input_charset or $default_output_charset not supported by Text::Iconv";
- }
- $message = $converter->convert($message) || die "Can not convert page from $input_charset to $default_output_charset" if $message;
- }
-
+ $message = Encode::decode($input_charset, $message );
+
my $default_error_str = $model->pkit_get_config_attr( GLOBAL => 'default_errorstr' ) || "#ff0000";
$message =~ s/<(!--)?\s*PKIT_ERRORSTR\s*(?(1)--)>/$default_error_str/gi;
@@ -290,7 +283,12 @@
}
sub fillinform {
- return shift->{pkit_pk}->{fillinform_object}->param(@_);
+ my $model = shift;
+ my @params = @_;
+ for ( @params ) {
+ Encode::_utf8_off( $_ ) unless ref $_;
+ }
+ return $model->{pkit_pk}->{fillinform_object}->param(@params);
}
sub ignore_fillinform_fields {
@@ -313,17 +311,7 @@
my ($model, %p) = @_;
my $view = $model->{pkit_pk}->{view};
my $input_charset = exists $p{input_charset} ? $p{input_charset} : $view->{default_input_charset};
- my $default_output_charset = $view->{default_output_charset};
- if ($input_charset ne $default_output_charset) {
- my $converter;
- eval {
( run in 0.949 second using v1.01-cache-2.11-cpan-f56aa216473 )