Noss/Home.pm

filter: Statementstmt 100% 20 / 20 Branchbran 50.0% 2 / 4 Conditioncond 40.0% 2 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 79.4% 31 / 39 CC 2 SCAR 2.8
CC
2
Cov
83%
home
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« Noss/GroupConfig.pm ↑ Summary
1 package WWW::Noss::Home;
2 2 ▶use 5.016;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 our $VERSION = '2.05';
6  
7 2 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 our @EXPORT_OK = qw(home);
9  
10 2 ▶my $HOME = $^O eq 'Win32' ? $ENV{ USERPROFILE } : (<~>)[0];
Subroutine BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
$^O eq 'Win32' ? : 0 2 2
11 2 ▶undef $HOME if defined $HOME and ! -d $HOME;
Branch: 1 branch
BranchTrueFalseTotal
if defined $HOME and not -d $HOME 0 2 2
Condition33%1/3
defined $HOME and not -d $HOME
!ll&&!rl&&r
020
MC/DC0%0/2
defined $HOME and not -d $HOME
defined $HOME not -d $HOME
Truth table33%1/3
A and not(B)
A= defined $HOMEB= not -d $HOME
ABresult
0X0
100
111
12  
13 3 ▶sub home { $HOME // die "Could not determine home directory\n" }
Subroutine home: called CC=2 SCAR=7.6
Pod documented
Condition50%1/2
$HOME // die("Could not determine home directory\n")
l!l
30
MC/DC0%0/1
$HOME // die("Could not determine home directory\n")
$HOME
Truth table50%1/2
A
A= $HOME
Aresult
11
00
14  
15 2 1;
16  
17 =head1 NAME
18  
19 WWW::Noss::Home - Find user's home directory
20  
21 =head1 USAGE
22  
23 use WWW::Noss::Home qw(home);
24  
25 my $home = home;
26  
27 =head1 DESCRIPTION
28  
29 B<WWW::Noss::Home> is a module that provides the C<home()> subroutine for
30 locating the running user's home directory. This is a private module, please
31 consult the L<noss> manual for user documentation.
32  
33 =head1 SUBROUTINES
34  
35 Subroutines are not exported automatically.
36  
37 =over 4
38  
39 =item $home = home()
40  
41 Returns the path to the running user's home directory. Dies on failure.
42  
43 =back
44  
45 =head1 AUTHOR
46  
47 Written by Samuel Young, E<lt>samyoung@posteo.comE<gt>.
48  
49 This project's source can be found on its
50 L<Codeberg page|https://codeberg.org/1-1sam/noss.git>. Comments and pull
51 requests are welcome!
52  
53 =head1 COPYRIGHT
54  
55 Copyright (C) 2025-2026 Samuel Young
56  
57 This program is free software: you can redistribute it and/or modify
58 it under the terms of the GNU General Public License as published by
59 the Free Software Foundation, either version 3 of the License, or
60 (at your option) any later version.
61  
62 =head1 SEE ALSO
63  
64 L<noss>
65  
66 =cut
67  
68 # vim: expandtab shiftwidth=4
« Noss/GroupConfig.pm ↑ Summary