Stubb/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
« Stubb/Render.pm ↑ Summary
1 package File::Stubb::Home;
2 3 ▶use 5.016;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 our $VERSION = '0.05';
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 our @EXPORT = qw(home);
9  
10 3 ▶my $HOME = $^O eq 'Win32' ? $ENV{ USERPROFILE } : (<~>)[0];
Subroutine BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
$^O eq 'Win32' ? : 0 3 3
11 3 ▶undef $HOME if defined $HOME and ! -d $HOME;
Branch: 1 branch
BranchTrueFalseTotal
if defined $HOME and not -d $HOME 0 3 3
Condition33%1/3
defined $HOME and not -d $HOME
!ll&&!rl&&r
030
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 14 ▶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
140
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 3 1;
16  
17 =head1 NAME
18  
19 File::Stubb::Home - Find user's home directory
20  
21 =head1 SYNOPSIS
22  
23 use EBook::Stub::Home;
24  
25 my $home = home;
26  
27 =head1 DESCRIPTION
28  
29 B<File::Stubb::Home> is a module that provides the C<home()> subroutine,
30 which returns the running user's home directory. This is developer
31 documentation, for L<stubb> 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<home()> C<die>s.
44  
45 =back
46  
47 =head1 AUTHOR
48  
49 Written by Samuel Young, E<lt>samyoung12788@gmail.comE<gt>.
50  
51 This project's source can be found on its
52 L<Codeberg page|https://codeberg.org/1-1sam/stubb>. Comments and pull
53 requests are welcome!
54  
55 =head1 COPYRIGHT
56  
57 Copyright (C) 2025-2026 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<stubb>
67  
68 =cut
69  
70 # vim: expandtab shiftwidth=4
« Stubb/Render.pm ↑ Summary