line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::HomeDir::MacOS9; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Half-assed implementation for the legacy Mac OS9 operating system. |
4
|
|
|
|
|
|
|
# Provided mainly to provide legacy compatibility. May be removed at |
5
|
|
|
|
|
|
|
# a later date. |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
965
|
use 5.008003; |
|
1
|
|
|
|
|
4
|
|
8
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
9
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
22
|
|
10
|
1
|
|
|
1
|
|
4
|
use Carp (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
11
|
1
|
|
|
1
|
|
7
|
use File::HomeDir::Driver (); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
6
|
use vars qw{$VERSION}; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
14
|
1
|
|
|
1
|
|
6
|
use base "File::HomeDir::Driver"; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
134
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
BEGIN |
17
|
|
|
|
|
|
|
{ |
18
|
1
|
|
|
1
|
|
389
|
$VERSION = '1.006'; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Load early if in a forking environment and we have |
22
|
|
|
|
|
|
|
# prefork, or at run-time if not. |
23
|
|
|
|
|
|
|
SCOPE: |
24
|
|
|
|
|
|
|
{ |
25
|
|
|
|
|
|
|
## no critic qw(RequireInitializationForLocalVars, RequireCheckingReturnValueOfEval) |
26
|
|
|
|
|
|
|
local $@; |
27
|
1
|
|
|
1
|
|
153
|
eval "use prefork 'Mac::Files'"; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
##################################################################### |
31
|
|
|
|
|
|
|
# Current User Methods |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub my_home |
34
|
|
|
|
|
|
|
{ |
35
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Try for $ENV{HOME} if we have it |
38
|
0
|
0
|
|
|
|
|
if (defined $ENV{HOME}) |
39
|
|
|
|
|
|
|
{ |
40
|
0
|
|
|
|
|
|
return $ENV{HOME}; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
### DESPERATION SETS IN |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# We could use the desktop |
46
|
|
|
|
|
|
|
SCOPE: |
47
|
|
|
|
|
|
|
{ |
48
|
|
|
|
|
|
|
## no critic qw(RequireInitializationForLocalVars, RequireCheckingReturnValueOfEval) |
49
|
0
|
|
|
|
|
|
local $@; |
|
0
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
eval { |
51
|
0
|
|
|
|
|
|
my $home = $class->my_desktop; |
52
|
0
|
0
|
0
|
|
|
|
return $home if $home and -d $home; |
53
|
|
|
|
|
|
|
}; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# Desperation on any platform |
57
|
|
|
|
|
|
|
SCOPE: |
58
|
|
|
|
|
|
|
{ |
59
|
|
|
|
|
|
|
# On some platforms getpwuid dies if called at all |
60
|
0
|
|
|
|
|
|
local $SIG{'__DIE__'} = ''; |
|
0
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
my $home = (getpwuid($<))[7]; |
62
|
0
|
0
|
0
|
|
|
|
return $home if $home and -d $home; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
Carp::croak("Could not locate current user's home directory"); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub my_desktop |
69
|
|
|
|
|
|
|
{ |
70
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# Find the desktop via Mac::Files |
73
|
0
|
|
|
|
|
|
local $SIG{'__DIE__'} = ''; |
74
|
0
|
|
|
|
|
|
require Mac::Files; |
75
|
0
|
|
|
|
|
|
my $home = Mac::Files::FindFolder(Mac::Files::kOnSystemDisk(), Mac::Files::kDesktopFolderType(),); |
76
|
0
|
0
|
0
|
|
|
|
return $home if $home and -d $home; |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
Carp::croak("Could not locate current user's desktop"); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
##################################################################### |
82
|
|
|
|
|
|
|
# General User Methods |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub users_home |
85
|
|
|
|
|
|
|
{ |
86
|
0
|
|
|
0
|
0
|
|
my ($class, $name) = @_; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
SCOPE: |
89
|
|
|
|
|
|
|
{ |
90
|
|
|
|
|
|
|
# On some platforms getpwnam dies if called at all |
91
|
0
|
|
|
|
|
|
local $SIG{'__DIE__'} = ''; |
|
0
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
my $home = (getpwnam($name))[7]; |
93
|
0
|
0
|
0
|
|
|
|
return $home if defined $home and -d $home; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
Carp::croak("Failed to find home directory for user '$name'"); |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=pod |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 NAME |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
File::HomeDir::MacOS9 - Find your home and other directories on legacy Macintosh systems |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 SYNOPSIS |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
use File::HomeDir; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
# Find directories for the current user |
112
|
|
|
|
|
|
|
$home = File::HomeDir->my_home; |
113
|
|
|
|
|
|
|
$desktop = File::HomeDir->my_desktop; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 DESCRIPTION |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
This module provides implementations for determining common user |
118
|
|
|
|
|
|
|
directories on legacy Mac hosts. In normal usage this module will always be |
119
|
|
|
|
|
|
|
used via L. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
This module is no longer actively maintained, and is included only for |
122
|
|
|
|
|
|
|
extreme back-compatibility. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Only the C and C methods are supported. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 SUPPORT |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
See the support section the main L module. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 AUTHORS |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Adam Kennedy Eadamk@cpan.orgE |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Sean M. Burke Esburke@cpan.orgE |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 SEE ALSO |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
L |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 COPYRIGHT |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Copyright 2005 - 2011 Adam Kennedy. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Copyright 2017 - 2020 Jens Rehsack |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Some parts copyright 2000 Sean M. Burke. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
This program is free software; you can redistribute |
149
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
The full text of the license can be found in the |
152
|
|
|
|
|
|
|
LICENSE file included with this module. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=cut |