line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package |
2
|
|
|
|
|
|
|
Win32::Shortcut::Readlink; |
3
|
|
|
|
|
|
|
|
4
|
3
|
|
|
3
|
|
15
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
92
|
|
5
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
78
|
|
6
|
3
|
|
|
3
|
|
15
|
use Carp qw( carp ); |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
236
|
|
7
|
3
|
|
|
3
|
|
16
|
use constant _is_cygwin => $^O eq 'cygwin'; |
|
3
|
|
|
|
|
20
|
|
|
3
|
|
|
|
|
311
|
|
8
|
3
|
|
|
3
|
|
21
|
use constant _is_mswin32 => $^O eq 'MSWin32'; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
191
|
|
9
|
3
|
|
|
3
|
|
15
|
use constant _is_windows => _is_cygwin || _is_mswin32; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
1259
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub _real_readlink (_); |
12
|
|
|
|
|
|
|
# TODO: only warn in 5.14 or earlier if warnings on in caller |
13
|
|
|
|
|
|
|
*_real_readlink = eval { require 5.016000 } ? \&CORE::readlink : sub (_) { CORE::readlink($_[0]) }; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub readlink (_) |
16
|
|
|
|
|
|
|
{ |
17
|
15
|
|
|
15
|
1
|
2457
|
goto &_real_readlink unless _is_windows; |
18
|
|
|
|
|
|
|
|
19
|
0
|
0
|
0
|
|
|
|
if(defined $_[0] && $_[0] =~ /\.lnk$/ && -r $_[0]) |
|
|
|
0
|
|
|
|
|
20
|
|
|
|
|
|
|
{ |
21
|
0
|
|
|
|
|
|
my $target = _win32_resolve(_is_cygwin ? Cygwin::posix_to_win_path($_[0]) : $_[0]); |
22
|
0
|
0
|
|
|
|
|
return $target if defined $target; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
goto &_real_readlink if _is_cygwin; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# else is MSWin32 |
28
|
|
|
|
|
|
|
# emulate unix failues |
29
|
0
|
0
|
|
|
|
|
if(!defined $_[0]) |
|
|
0
|
|
|
|
|
|
30
|
|
|
|
|
|
|
{ |
31
|
|
|
|
|
|
|
# TODO: only warn if warnings on in caller |
32
|
0
|
|
|
|
|
|
carp "Use of uninitialized value in readlink"; |
33
|
0
|
|
|
|
|
|
$! = 22; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
elsif(-e $_[0]) |
36
|
|
|
|
|
|
|
{ |
37
|
0
|
|
|
|
|
|
$! = 22; # Invalid argument |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
else |
40
|
|
|
|
|
|
|
{ |
41
|
0
|
|
|
|
|
|
$! = 2; # No such file or directory |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
return; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |