Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package PerlIO::via::Samurai;
- use strict;
- use warnings;
- use Encode;
- use Acme::Samurai;
- sub import {
- binmode STDOUT => ':via(Samurai)';
- }
- sub PUSHED {
- my ($class, $mode, $fh) = @_;
- bless {}, $class;
- }
- sub WRITE {
- my ($self, $buf, $fh) = @_;
- print $fh $self->gozaru($buf);
- 1;
- }
- sub gozaru {
- my ($self, $text) = @_;
- $text = Encode::decode_utf8($text);
- $text = Acme::Samurai->gozaru($text);
- Encode::encode_utf8($text);
- }
Add Comment
Please, Sign In to add comment