File Coverage

blib/lib/Net/Amazon/MechanicalTurk/OSUtil.pm
Criterion Covered Total %
statement 5 8 62.5
branch 1 2 50.0
condition n/a
subroutine 1 1 100.0
pod 0 1 0.0
total 7 12 58.3


line stmt bran cond sub pod time code
1             package Net::Amazon::MechanicalTurk::OSUtil;
2              
3             our $VERSION = '1.00';
4              
5             sub homeDirectory {
6 17     17 0 36 my $homeDir;
7 17         38 eval {
8             # Looks up home directory for effective user id
9 17         18151 $homeDir = [getpwuid($>)]->[7];
10             };
11 17 50       122 if ($@) {
12             # getpwuid doesn't seem to work on ActivePerl
13             # Try using the Windows API to get the home directory.
14 0         0 eval {
15 0         0 require Win32;
16 0         0 $homeDir = Win32::GetFolderPath(Win32::CSIDL_PROFILE());
17             };
18             }
19 17         83 return $homeDir;
20             }
21              
22             return 1;