| Template-Stash-Encode documentation | Contained in the Template-Stash-Encode distribution. |
Template::Stash::Encode - Encode charactor code on stash variables
Version 0.03
use Template::Stash::Encode; use Template; my Template $tt = Template->new( STASH => Template::Stash::Encode->new(icode => 'utf8', ocode => 'shiftjis') );
Constructor (See Template::Stash). See below constructor parameter of hash reference.
Override method.
Toru Yamaguchi, <zigorou at cpan.org>
Please report any bugs or feature requests to
bug-template-stash-encode at rt.cpan.org, or through the web interface at
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Template-Stash-Encode.
I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.
You can find documentation for this module with the perldoc command.
perldoc Template::Stash::Encode
You can also look for information at:
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Template-Stash-Encode
Copyright 2006 Toru Yamaguchi, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Template-Stash-Encode documentation | Contained in the Template-Stash-Encode distribution. |
package Template::Stash::Encode; use strict; use warnings; use Encode; use Template::Config; use base $Template::Config::STASH;
our $VERSION = '0.03';
sub new { my $class = shift; my $self = $class->SUPER::new(@_); $self->{icode} = 'utf8' unless (exists $self->{icode} && $self->{icode}); $self->{ocode} = 'utf8' unless (exists $self->{ocode} && $self->{ocode}); return $self; }
sub get { my $self = shift; my $result = $self->SUPER::get(@_); return $result if (ref $result); Encode::from_to($result, $self->{icode}, $self->{ocode}); return $result; }
1; # End of Template::Stash::Encode