Egg::Plugin::Charset - Base class for Charset plugin.


Egg-Release documentation  | view source Contained in the Egg-Release distribution.

Index


NAME

Top

Egg::Plugin::Charset - Base class for Charset plugin.

SYNOPSIS

Top

  use Egg qw/ Charset::UTF8 /;

DESCRIPTION

Top

This module is a base class for the following subclasses.

* Egg::Plugin::Charset::UTF8
* Egg::Plugin::Charset::EUC_JP
* Egg::Plugin::Charset::Shift_JIS

This module does interrupt to '_output'. And, the character-code of contents set in $e->response->body is changed.

The module with this method of '_convert_body' is made to make the subclass by oneself, and processing that converts the character-code in this method is written.

  package Egg::Plugin::Charset::AnyCode;
  use strict;
  use ConvertAny;

  sub _setup {
     my($e)= @_;
     $e->config->{content_language}= 'ja';
     $e->config->{charset_out}= "AnyCode";
     $e->next::method;
  }
  sub _convert_body {
     my $e    = shift;
     my $body = shift || return 0;
     $$body= ConvertAny->convert($body);  # $body is SCALAR reference.
  }

I think that it doesn't want to process this plug-in at times.

METHODS

Top

no_convert ([BOOL])

The processing of this plugin can temporarily be canceled for this case by setting an effective value to $e->no_convert.

  $e->no_convert(1);

get_convert_body

The contents sources to be converted are returned.

Undefined is returned when $e->no_convert or $e->request->is_head or $e->response->attachment is effective.

Undefined is returned if there is no $e->response->content_type in the text system.

SEE ALSO

Top

Egg::Release, Egg::Plugin::Charset::UTF8, Egg::Plugin::Charset::EUC_JP, Egg::Plugin::Charset::Shift_JIS,

AUTHOR

Top

Masatoshi Mizuno <lushe&64;cpan.org>

COPYRIGHT AND LICENSE

Top


Egg-Release documentation  | view source Contained in the Egg-Release distribution.