Path::ExpandTilde - Expand tilde (~) to homedir in file paths
use Path::ExpandTilde; my $homedir = expand_tilde('~'); my $bashrc = expand_tilde('~/.bashrc'); my $pg_home = expand_tilde('~postgres');
my $new_path = expand_tilde($path);
Exported by default. If the path starts with
~, expands that to the current user's home directory. If the path starts with
~username, expands that to the specified user's home directory. If the user doesn't exist, no expansion is done. The returned path is canonicalized as by "canonpath" in File::Spec either way.
The algorithm should be portable to most operating systems supported by Perl, though the home directory may not be found by
bsd_glob on some.
Report any issues on the public bugtracker.
Dan Book <email@example.com>
This software is Copyright (c) 2018 by Dan Book.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)