This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Win32 from version 0.54 to 0.56
[perl5.git] / t / lib / Cname.pm
CommitLineData
fc8cd66c
YO
1package Cname;
2our $Evil='A';
3
4sub translator {
c5f9609a
KW
5
6 # Returns the input as a name, except for these special ones
7
fc8cd66c
YO
8 my $str = shift;
9 if ( $str eq 'EVIL' ) {
ff3f963a 10 # Returns A first time, AB second, ABC third ... A-ZA the 27th time.
fc8cd66c
YO
11 (my $c=substr("A".$Evil,-1))++;
12 my $r=$Evil;
13 $Evil.=$c;
14 return $r;
15 }
16 if ( $str eq 'EMPTY-STR') {
17 return "";
18 }
ff3f963a
KW
19 if ( $str eq 'NULL') {
20 return "\0";
21 }
22 if ( $str eq 'LONG-STR') {
23 return 'A' x 255;
24 }
25 # Should exceed limit for regex \N bytes in a sequence. Anyway it will if
26 # UCHAR_MAX is 255.
27 if ( $str eq 'TOO-LONG-STR') {
28 return 'A' x 256;
29 }
c5f9609a 30
fc8cd66c
YO
31 return $str;
32}
33
34sub import {
35 shift;
36 $^H{charnames} = \&translator;
37}
381;