File Coverage

blib/lib/EBook/Gutenberg/Home.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition 1 2 50.0
subroutine 5 5 100.0
pod 1 1 100.0
total 19 20 95.0


line stmt bran cond sub pod time code
1             package EBook::Gutenberg::Home;
2 3     3   78639 use 5.016;
  3         10  
3             our $VERSION = '1.00';
4 3     3   17 use strict;
  3         6  
  3         81  
5 3     3   18 use warnings;
  3         29  
  3         158  
6              
7 3     3   15 use Exporter 'import';
  3         18  
  3         499  
8             our @EXPORT = qw(home);
9              
10             my $HOME = $^O eq 'Win32' ? $ENV{ USERPROFILE } : (<~>)[0];
11             undef $HOME if defined $HOME and ! -d $HOME;
12              
13 5   50 5 1 163485 sub home { $HOME // die "Could not determine home directory\n" }
14              
15             1;
16              
17             =head1 NAME
18              
19             EBook::Gutenberg::Home - Find user's home directory
20              
21             =head1 SYNOPSIS
22              
23             use EBook::Gutenberg::Home;
24              
25             my $home = home;
26              
27             =head1 DESCRIPTION
28              
29             B is a module that provides the C subroutine,
30             which returns the running user's home directory. This is developer
31             documentation, for L user documentation you should consult its
32             manual.
33              
34             =head1 SUBROUTINES
35              
36             All subroutines are exported automatically.
37              
38             =over 4
39              
40             =item $home = home()
41              
42             Returns the running user's home directory. If the home directory cannot be
43             found, C Cs.
44              
45             =back
46              
47             =head1 AUTHOR
48              
49             Written by Samuel Young, Esamyoung12788@gmail.comE.
50              
51             This project's source can be found on its
52             L. Comments and pull
53             requests are welcome!
54              
55             =head1 COPYRIGHT
56              
57             Copyright (C) 2025 Samuel Young
58              
59             This program is free software: you can redistribute it and/or modify
60             it under the terms of the GNU General Public License as published by
61             the Free Software Foundation, either version 3 of the License, or
62             (at your option) any later version.
63              
64             =head1 SEE ALSO
65              
66             L
67              
68             =cut
69              
70             # vim: expandtab shiftwidth=4