| 1 | package usw; | ||||||||||
| 2 | 10 | ▶ | use 5.012005; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | 10 | our $VERSION = "0.06"; | |||||||||
| 5 | |||||||||||
| 6 | 10 | ▶ | use Encode qw(is_utf8 encode_utf8 decode_utf8); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 10 | ▶ | use utf8(); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 10 | ▶ | use strict(); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 10 | ▶ | use warnings(); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 10 | ▶ | use List::Util qw(first); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | sub import { | ||||||||||
| 13 | 9 | ▶ | utf8->import; | ||||||||
|
Subroutine
import: called CC=4 SCAR=13.9
| |||||||||||
| 14 | 9 | strict->import; | |||||||||
| 15 | 9 | warnings->import( 'all', FATAL => 'recursion' ); | |||||||||
| 16 | |||||||||||
| 17 | #binmode \*STDIN, ":encoding(UTF-8)"; | ||||||||||
| 18 | 9 | ▶ | binmode \*STDOUT, ":encoding(UTF-8)"; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 9 | binmode \*STDERR, ":encoding(UTF-8)"; | |||||||||
| 20 | 9 | ▶ | return unless @_; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | |||||||||||
| 22 | 9 | ▶ | $SIG{__WARN__} = \&_redecode if first { $_ eq 'warn' } @_; | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||
| 23 | 3 | ▶ | $SIG{__DIE__} = sub { die _redecode(@_) } | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 24 | 9 | ▶ | if first { $_ eq 'die' } @_; | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||
| 25 | |||||||||||
| 26 | 9 | return; | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | sub _redecode { | ||||||||||
| 30 | 6 | ▶ | $_[0] =~ /^(.+) at (.+) line (\d+)\.$/; | ||||||||
|
Subroutine
_redecode: called CC=2 SCAR=6.9
| |||||||||||
| 31 | 6 | my @texts = split $2, $_[0]; | |||||||||
| 32 | 6 | ▶ | return is_utf8($1) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | ? $texts[0] . decode_utf8 $2. $texts[1] | ||||||||||
| 34 | : decode_utf8 $_[0]; | ||||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | 10 | 1; | |||||||||
| 38 | |||||||||||
| 39 | __END__ | ||||||||||