Simplify loading madness back to what I was originally trying to do
[catagits/Catalyst-Runtime.git] / t / lib / TestAppEncoding / Controller / Root.pm
CommitLineData
5ab21903 1package TestAppEncoding::Controller::Root;
2use strict;
3use warnings;
4use base 'Catalyst::Controller';
5use Test::More;
6
7__PACKAGE__->config->{namespace} = '';
8
9sub binary : Local {
10 my ($self, $c) = @_;
b9b257cc 11 $c->res->body(do {
a8946dc8 12 open(my $fh, '<', $c->path_to('..', '..', 'catalyst_130pix.gif')) or die $!;
efcb1ae7 13 binmode($fh);
14 local $/ = undef; <$fh>;
15 });
5ab21903 16}
17
18sub binary_utf8 : Local {
19 my ($self, $c) = @_;
20 $c->forward('binary');
21 my $str = $c->res->body;
22 utf8::upgrade($str);
23 ok utf8::is_utf8($str), 'Body is variable width encoded string';
24 $c->res->body($str);
25}
26
d9669e44 27# called by t/aggregate/catalyst_test_utf8.t
28sub utf8_non_ascii_content : Local {
29 use utf8;
30 my ($self, $c) = @_;
31
32 my $str = 'ʇsʎlɐʇɐɔ'; # 'catalyst' flipped at http://www.revfad.com/flip.html
33 ok utf8::is_utf8($str), '$str is in UTF8 internally';
34
35 # encode $str into a sequence of octets and turn off the UTF-8 flag, so that
36 # we don't get the 'Wide character in syswrite' error in Catalyst::Engine
37 utf8::encode($str);
38 ok !utf8::is_utf8($str), '$str is a sequence of octets (byte string)';
39
40 $c->res->body($str);
41}
42
43
5ab21903 44sub end : Private {
45 my ($self,$c) = @_;
46}
47
481;