line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright 2009, 2010, 2012, 2014 Kevin Ryde |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# This file is part of I18N-Langinfo-Wide. |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# I18N-Langinfo-Wide is free software; you can redistribute it and/or modify |
6
|
|
|
|
|
|
|
# it under the terms of the GNU General Public License as published by the |
7
|
|
|
|
|
|
|
# Free Software Foundation; either version 3, or (at your option) any later |
8
|
|
|
|
|
|
|
# version. |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
# I18N-Langinfo-Wide is distributed in the hope that it will be useful, but |
11
|
|
|
|
|
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
12
|
|
|
|
|
|
|
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
13
|
|
|
|
|
|
|
# for more details. |
14
|
|
|
|
|
|
|
# |
15
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License along |
16
|
|
|
|
|
|
|
# with I18N-Langinfo-Wide. If not, see . |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
package POSIX::Wide::EXTENDED_OS_ERROR; |
19
|
1
|
|
|
1
|
|
42
|
use 5.008001; # for utf8::is_utf8() |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
56
|
|
20
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
45
|
|
21
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
52
|
|
22
|
1
|
|
|
1
|
|
10
|
use I18N::Langinfo::Wide; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
72
|
|
23
|
1
|
|
|
1
|
|
7
|
use Scalar::Util; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
408
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# uncomment this to run the ### lines |
26
|
|
|
|
|
|
|
#use Smart::Comments; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
our $VERSION = 8; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub TIESCALAR { |
31
|
1
|
|
|
1
|
|
3
|
my ($class) = @_; |
32
|
1
|
|
|
|
|
2
|
my $self; |
33
|
1
|
|
|
|
|
6
|
return bless \$self, $class; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# dualvar() in Scalar::Util 1.22 (post perl 5.10.1) will propagate the |
37
|
|
|
|
|
|
|
# utf8 flag on its own, for prior versions must turn it on explicitly |
38
|
|
|
|
|
|
|
# |
39
|
|
|
|
|
|
|
# $^E fetching in Perl_magic_get(): |
40
|
|
|
|
|
|
|
# |
41
|
|
|
|
|
|
|
# $^E on MacOS is GetSysErrText. Is that mac-roman maybe? |
42
|
|
|
|
|
|
|
# |
43
|
|
|
|
|
|
|
# $^E on VMS is sys$getmsg. Is that the selected NLS thingie? |
44
|
|
|
|
|
|
|
# |
45
|
|
|
|
|
|
|
# $^E on ms-dos is GetLastError. |
46
|
|
|
|
|
|
|
# |
47
|
|
|
|
|
|
|
# $^E on OS2 is DosGetMessage or OSO001.MSG. |
48
|
|
|
|
|
|
|
# |
49
|
|
|
|
|
|
|
BEGIN { |
50
|
1
|
50
|
|
1
|
|
4
|
if (do { my $u = 'x'; |
|
1
|
|
|
|
|
13
|
|
51
|
1
|
|
|
|
|
7
|
utf8::upgrade($u); |
52
|
1
|
|
|
|
|
7
|
my $e = Scalar::Util::dualvar(0,$u); |
53
|
1
|
|
|
|
|
11
|
utf8::is_utf8($e) }) { |
54
|
|
|
|
|
|
|
### dualvar() is utf8 |
55
|
1
|
50
|
|
|
|
118
|
eval "\n#line ".(__LINE__+1)." \"".__FILE__."\"\n" . <<'HERE' or die; |
56
|
|
|
|
|
|
|
sub FETCH { |
57
|
4
|
|
|
4
|
|
2424
|
return Scalar::Util::dualvar |
58
|
|
|
|
|
|
|
($^E, I18N::Langinfo::Wide::to_wide("$^E")); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
HERE |
62
|
|
|
|
|
|
|
} else { |
63
|
|
|
|
|
|
|
### dualvar() is not utf8, using _utf8_on() |
64
|
0
|
|
|
|
|
0
|
require Encode; |
65
|
0
|
0
|
|
|
|
0
|
eval "\n#line ".(__LINE__+1)." \"".__FILE__."\"\n" . <<'HERE' or die; |
66
|
|
|
|
|
|
|
sub FETCH { |
67
|
|
|
|
|
|
|
my $e = Scalar::Util::dualvar |
68
|
|
|
|
|
|
|
($^E, I18N::Langinfo::Wide::to_wide("$^E")); |
69
|
|
|
|
|
|
|
Encode::_utf8_on($e); |
70
|
|
|
|
|
|
|
return $e; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
1; |
73
|
|
|
|
|
|
|
HERE |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub STORE { |
78
|
0
|
|
|
0
|
|
|
my ($self, $value) = @_; |
79
|
0
|
|
|
|
|
|
$^E = $value; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |
83
|
|
|
|
|
|
|
__END__ |