| 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
| |||||||||||||||||||||||||||||
| 11 | 3 | ▶ | undef $HOME if defined $HOME and ! -d $HOME; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $HOME and not -d $HOME
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
| |||||||||||||||||||||||||||||
| 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")
MC/DC0%0/1
$HOME // die("Could not determine home directory\n")
$HOME
Truth table50%1/2
A
A= $HOME
| |||||||||||||||||||||||||||||
| 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 | ||||||||||||||||||||||||||||