line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
29580
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
2
|
|
|
|
|
|
|
package File::Path::Expand; |
3
|
1
|
|
|
1
|
|
1707
|
use User::pwent; |
|
1
|
|
|
|
|
16544
|
|
|
1
|
|
|
|
|
8
|
|
4
|
1
|
|
|
1
|
|
93
|
use Carp qw(croak); |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
48
|
|
5
|
1
|
|
|
1
|
|
6
|
use Exporter; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
33
|
|
6
|
1
|
|
|
1
|
|
10
|
use base 'Exporter'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
102
|
|
7
|
1
|
|
|
1
|
|
4
|
use vars qw( $VERSION @EXPORT @EXPORT_OK ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
254
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
$VERSION = '1.02'; |
10
|
|
|
|
|
|
|
@EXPORT = qw( expand_filename ); |
11
|
|
|
|
|
|
|
@EXPORT_OK = qw( expand_filename home_of ); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub expand_filename { |
14
|
2
|
|
|
2
|
0
|
17
|
my $path = shift; |
15
|
2
|
50
|
|
|
|
12
|
$path =~ s{^~(?=/|$)}{ $ENV{HOME} ? "$ENV{HOME}" : home_of( $> ) }e |
|
2
|
50
|
|
|
|
16
|
|
16
|
0
|
|
|
|
|
0
|
or $path =~ s{^~(.+?)(?=/|$)}{ home_of( $1 ) }e; |
17
|
2
|
|
|
|
|
14
|
return $path; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub home_of { |
21
|
0
|
|
|
0
|
0
|
|
my $user = shift; |
22
|
0
|
0
|
|
|
|
|
my $ent = getpw($user) |
23
|
|
|
|
|
|
|
or croak "no such user '$user'"; |
24
|
0
|
|
|
|
|
|
return $ent->dir; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
28
|
|
|
|
|
|
|
__END__ |