.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
.    ds C`
.    ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
.    if \nF \{
.        de IX
.        tm Index:\\$1\t\\n%\t"\\$2"
..
.        if !\nF==2 \{
.            nr % 0
.            nr F 2
.        \}
.    \}
.\}
.rr rF
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "File::HomeDir 3"
.TH File::HomeDir 3 "2012-10-19" "perl v5.16.3" "User Contributed Perl Documentation"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
File::HomeDir \- Find your home and other directories on any platform
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\&  use File::HomeDir;
\&  
\&  # Modern Interface (Current User)
\&  $home     = File::HomeDir\->my_home;
\&  $desktop  = File::HomeDir\->my_desktop;
\&  $docs     = File::HomeDir\->my_documents;
\&  $music    = File::HomeDir\->my_music;
\&  $pics     = File::HomeDir\->my_pictures;
\&  $videos   = File::HomeDir\->my_videos;
\&  $data     = File::HomeDir\->my_data;
\&  $dist     = File::HomeDir\->my_dist_data(\*(AqFile\-HomeDir\*(Aq);
\&  $dist     = File::HomeDir\->my_dist_config(\*(AqFile\-HomeDir\*(Aq);
\&  
\&  # Modern Interface (Other Users)
\&  $home    = File::HomeDir\->users_home(\*(Aqfoo\*(Aq);
\&  $desktop = File::HomeDir\->users_desktop(\*(Aqfoo\*(Aq);
\&  $docs    = File::HomeDir\->users_documents(\*(Aqfoo\*(Aq);
\&  $music   = File::HomeDir\->users_music(\*(Aqfoo\*(Aq);
\&  $pics    = File::HomeDir\->users_pictures(\*(Aqfoo\*(Aq);
\&  $video   = File::HomeDir\->users_videos(\*(Aqfoo\*(Aq);
\&  $data    = File::HomeDir\->users_data(\*(Aqfoo\*(Aq);
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
\&\fBFile::HomeDir\fR is a module for locating the directories that are \*(L"owned\*(R"
by a user (typicaly your user) and to solve the various issues that arise
trying to find them consistently across a wide variety of platforms.
.PP
The end result is a single \s-1API\s0 that can find your resources on any platform,
making it relatively trivial to create Perl software that works elegantly
and correctly no matter where you run it.
.PP
This module provides two main interfaces.
.PP
The first is a modern File::Spec\-style interface with a consistent
\&\s-1OO API\s0 and different implementation modules to support various
platforms. You are \fBstrongly\fR recommended to use this interface.
.PP
The second interface is for legacy support of the original 0.07 interface
that exported a \f(CW\*(C`home()\*(C'\fR function by default and tied the \f(CW\*(C`%~\*(C'\fR variable.
.PP
It is generally not recommended that you use this interface, but due to
back-compatibility reasons they will remain supported until at least 2010.
.PP
The \f(CW\*(C`%~\*(C'\fR interface has been deprecated. Documentation was removed in 2009,
Unit test were removed in 2011, usage will issue warnings from 2012, and the
interface will be removed entirely in 2015  (in line with the general Perl
toolchain convention of a 10 year support period for legacy APIs that
are potentially or actually in common use).
.SS "Platform Neutrality"
.IX Subsection "Platform Neutrality"
In the Unix world, many different types of data can be mixed together
in your home directory (although on some Unix platforms this is no longer
the case, particularly for \*(L"desktop\*(R"\-oriented platforms).
.PP
On some non-Unix platforms, separate directories are allocated for
different types of data and have been for a long time.
.PP
When writing applications on top of \fBFile::HomeDir\fR, you should thus
always try to use the most specific method you can. User documents should
be saved in \f(CW\*(C`my_documents\*(C'\fR, data that supports an application but isn't
normally editing by the user directory should go into \f(CW\*(C`my_data\*(C'\fR.
.PP
On platforms that do not make any distinction, all these different
methods will harmlessly degrade to the main home directory, but on
platforms that care \fBFile::HomeDir\fR will always try to Do The Right
Thing(tm).
.SH "METHODS"
.IX Header "METHODS"
Two types of methods are provided. The \f(CW\*(C`my_method\*(C'\fR series of methods for
finding resources for the current user, and the \f(CW\*(C`users_method\*(C'\fR (read as
\&\*(L"user's method\*(R") series for finding resources for arbitrary users.
.PP
This split is necessary, as on most platforms it is \fBmuch\fR easier to find
information about the current user compared to other users, and indeed
on a number you cannot find out information such as \f(CW\*(C`users_desktop\*(C'\fR at
all, due to security restrictions.
.PP
All methods will double check (using a \f(CW\*(C`\-d\*(C'\fR test) that a directory
actually exists before returning it, so you may trust in the values
that are returned (subject to the usual caveats of race conditions of
directories being deleted at the moment between a directory being returned
and you using it).
.PP
However, because in some cases platforms may not support the concept of home
directories at all, any method may return \f(CW\*(C`undef\*(C'\fR (both in scalar and list
context) to indicate that there is no matching directory on the system.
.PP
For example, most untrusted 'nobody'\-type users do not have a home
directory. So any modules that are used in a \s-1CGI\s0 application that
at some level of recursion use your code, will result in calls to
File::HomeDir returning undef, even for a basic \fIhome()\fR call.
.SS "my_home"
.IX Subsection "my_home"
The \f(CW\*(C`my_home\*(C'\fR method takes no arguments and returns the main home/profile
directory for the current user.
.PP
If the distinction is important to you, the term \*(L"current\*(R" refers to the
real user, and not the effective user.
.PP
This is also the case for all of the other \*(L"my\*(R" methods.
.PP
Returns the directory path as a string, \f(CW\*(C`undef\*(C'\fR if the current user
does not have a home directory, or dies on error.
.SS "my_desktop"
.IX Subsection "my_desktop"
The \f(CW\*(C`my_desktop\*(C'\fR method takes no arguments and returns the \*(L"desktop\*(R"
directory for the current user.
.PP
Due to the diversity and complexity of implementions required to deal with
implementing the required functionality fully and completely, the
\&\f(CW\*(C`my_desktop\*(C'\fR method may or may not be implemented on each platform.
.PP
That said, I am extremely interested in code to implement \f(CW\*(C`my_desktop\*(C'\fR on
Unix, as long as it is capable of dealing (as the Windows implementation
does) with internationalisation. It should also avoid false positive
results by making sure it only returns the appropriate directories for the
appropriate platforms.
.PP
Returns the directory path as a string, \f(CW\*(C`undef\*(C'\fR if the current user
does not have a desktop directory, or dies on error.
.SS "my_documents"
.IX Subsection "my_documents"
The \f(CW\*(C`my_documents\*(C'\fR method takes no arguments and returns the directory (for
the current user) where the user's documents are stored.
.PP
Returns the directory path as a string, \f(CW\*(C`undef\*(C'\fR if the current user
does not have a documents directory, or dies on error.
.SS "my_music"
.IX Subsection "my_music"
The \f(CW\*(C`my_music\*(C'\fR method takes no arguments and returns the directory
where the current user's music is stored.
.PP
No bias is made to any particular music type or music program, rather the
concept of a directory to hold the user's music is made at the level of the
underlying operating system or (at least) desktop environment.
.PP
Returns the directory path as a string, \f(CW\*(C`undef\*(C'\fR if the current user
does not have a suitable directory, or dies on error.
.SS "my_pictures"
.IX Subsection "my_pictures"
The \f(CW\*(C`my_pictures\*(C'\fR method takes no arguments and returns the directory
where the current user's pictures are stored.
.PP
No bias is made to any particular picture type or picture program, rather the
concept of a directory to hold the user's pictures is made at the level of the
underlying operating system or (at least) desktop environment.
.PP
Returns the directory path as a string, \f(CW\*(C`undef\*(C'\fR if the current user
does not have a suitable directory, or dies on error.
.SS "my_videos"
.IX Subsection "my_videos"
The \f(CW\*(C`my_videos\*(C'\fR method takes no arguments and returns the directory
where the current user's videos are stored.
.PP
No bias is made to any particular video type or video program, rather the
concept of a directory to hold the user's videos is made at the level of the
underlying operating system or (at least) desktop environment.
.PP
Returns the directory path as a string, \f(CW\*(C`undef\*(C'\fR if the current user
does not have a suitable directory, or dies on error.
.SS "my_data"
.IX Subsection "my_data"
The \f(CW\*(C`my_data\*(C'\fR method takes no arguments and returns the directory where
local applications should stored their internal data for the current
user.
.PP
Generally an application would create a subdirectory such as \f(CW\*(C`.foo\*(C'\fR,
beneath this directory, and store its data there. By creating your
directory this way, you get an accurate result on the maximum number of
platforms. But see the documentation about \f(CW\*(C`my_dist_config()\*(C'\fR or
\&\f(CW\*(C`my_dist_data()\*(C'\fR below.
.PP
For example, on Unix you get \f(CW\*(C`~/.foo\*(C'\fR and on Win32 you get
\&\f(CW\*(C`~/Local Settings/Application Data/.foo\*(C'\fR
.PP
Returns the directory path as a string, \f(CW\*(C`undef\*(C'\fR if the current user
does not have a data directory, or dies on error.
.SS "my_dist_config"
.IX Subsection "my_dist_config"
.Vb 1
\&  File::HomeDir\->my_dist_config( $dist [, \e%params] );
\&  
\&  # For example...
\&  
\&  File::HomeDir\->my_dist_config( \*(AqFile\-HomeDir\*(Aq );
\&  File::HomeDir\->my_dist_config( \*(AqFile\-HomeDir\*(Aq, { create => 1 } );
.Ve
.PP
The \f(CW\*(C`my_dist_config\*(C'\fR method takes a distribution name as argument and
returns an application-specific directory where they should store their
internal configuration.
.PP
The base directory will be either \f(CW\*(C`my_config\*(C'\fR if the platform supports
it, or \f(CW\*(C`my_documents\*(C'\fR otherwise. The subdirectory itself will be 
\&\f(CW\*(C`BASE/Perl/Dist\-Name\*(C'\fR. If the base directory is the user's homedir,
\&\f(CW\*(C`my_dist_config\*(C'\fR will be in \f(CW\*(C`~/.perl/Dist\-Name\*(C'\fR (and thus be hidden on
all Unixes).
.PP
The optional last argument is a hash reference to tweak the method
behaviour. The following hash keys are recognized:
.IP "\(bu" 4
create
.Sp
Passing a true value to this key will force the creation of the
directory if it doesn't exist (remember that \f(CW\*(C`File::HomeDir\*(C'\fR's policy
is to return \f(CW\*(C`undef\*(C'\fR if the directory doesn't exist).
.Sp
Defaults to false, meaning no automatic creation of directory.
.SS "my_dist_data"
.IX Subsection "my_dist_data"
.Vb 1
\&  File::HomeDir\->my_dist_data( $dist [, \e%params] );
\&  
\&  # For example...
\&  
\&  File::HomeDir\->my_dist_data( \*(AqFile\-HomeDir\*(Aq );
\&  File::HomeDir\->my_dist_data( \*(AqFile\-HomeDir\*(Aq, { create => 1 } );
.Ve
.PP
The \f(CW\*(C`my_dist_data\*(C'\fR method takes a distribution name as argument and
returns an application-specific directory where they should store their
internal data.
.PP
This directory will be of course a subdirectory of \f(CW\*(C`my_data\*(C'\fR. Platforms
supporting data-specific directories will use
\&\f(CW\*(C`DATA_DIR/perl/dist/Dist\-Name\*(C'\fR following the common
\&\*(L"DATA/vendor/application\*(R" pattern. If the \f(CW\*(C`my_data\*(C'\fR directory is the
user's homedir, \f(CW\*(C`my_dist_data\*(C'\fR will be in \f(CW\*(C`~/.perl/dist/Dist\-Name\*(C'\fR
(and thus be hidden on all Unixes).
.PP
The optional last argument is a hash reference to tweak the method
behaviour. The following hash keys are recognized:
.IP "\(bu" 4
create
.Sp
Passing a true value to this key will force the creation of the
directory if it doesn't exist (remember that \f(CW\*(C`File::HomeDir\*(C'\fR's policy
is to return \f(CW\*(C`undef\*(C'\fR if the directory doesn't exist).
.Sp
Defaults to false, meaning no automatic creation of directory.
.SS "users_home"
.IX Subsection "users_home"
.Vb 1
\&  $home = File::HomeDir\->users_home(\*(Aqfoo\*(Aq);
.Ve
.PP
The \f(CW\*(C`users_home\*(C'\fR method takes a single param and is used to locate the
parent home/profile directory for an identified user on the system.
.PP
While most of the time this identifier would be some form of user name,
it is permitted to vary per-platform to support user ids or UUIDs as
applicable for that platform.
.PP
Returns the directory path as a string, \f(CW\*(C`undef\*(C'\fR if that user
does not have a home directory, or dies on error.
.SS "users_documents"
.IX Subsection "users_documents"
.Vb 1
\&  $docs = File::HomeDir\->users_documents(\*(Aqfoo\*(Aq);
.Ve
.PP
Returns the directory path as a string, \f(CW\*(C`undef\*(C'\fR if that user
does not have a documents directory, or dies on error.
.SS "users_data"
.IX Subsection "users_data"
.Vb 1
\&  $data = File::HomeDir\->users_data(\*(Aqfoo\*(Aq);
.Ve
.PP
Returns the directory path as a string, \f(CW\*(C`undef\*(C'\fR if that user
does not have a data directory, or dies on error.
.SH "FUNCTIONS"
.IX Header "FUNCTIONS"
.SS "home"
.IX Subsection "home"
.Vb 5
\&  use File::HomeDir;
\&  $home = home();
\&  $home = home(\*(Aqfoo\*(Aq);
\&  $home = File::HomeDir::home();
\&  $home = File::HomeDir::home(\*(Aqfoo\*(Aq);
.Ve
.PP
The \f(CW\*(C`home\*(C'\fR function is exported by default and is provided for
compatibility with legacy applications. In new applications, you should
use the newer method-based interface above.
.PP
Returns the directory path to a named user's home/profile directory.
.PP
If provided no param, returns the directory path to the current user's
home/profile directory.
.SH "TO DO"
.IX Header "TO DO"
.IP "\(bu" 4
Add more granularity to Unix, and add support to \s-1VMS\s0 and other
esoteric platforms, so we can consider going core.
.IP "\(bu" 4
Add consistent support for users_* methods
.SH "SUPPORT"
.IX Header "SUPPORT"
This module is stored in an Open Repository at the following address.
.PP
<http://svn.ali.as/cpan/trunk/File\-HomeDir>
.PP
Write access to the repository is made available automatically to any
published \s-1CPAN\s0 author, and to most other volunteers on request.
.PP
If you are able to submit your bug report in the form of new (failing)
unit tests, or can apply your fix directly instead of submitting a patch,
you are \fBstrongly\fR encouraged to do so as the author currently maintains
over 100 modules and it can take some time to deal with non-Critical bug
reports or patches.
.PP
This will guarantee that your issue will be addressed in the next
release of the module.
.PP
If you cannot provide a direct test or fix, or don't have time to do so,
then regular bug reports are still accepted and appreciated via the \s-1CPAN\s0
bug tracker.
.PP
<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=File\-HomeDir>
.PP
For other issues, for commercial enhancement or support, or to have your
write access enabled for the repository, contact the author at the email
address above.
.SH "ACKNOWLEDGEMENTS"
.IX Header "ACKNOWLEDGEMENTS"
The biggest acknowledgement goes to Chris Nandor, who wielded his
legendary Mac-fu and turned my initial fairly ordinary Darwin
implementation into something that actually worked properly everywhere,
and then donated a Mac \s-1OS X\s0 license to allow it to be maintained properly.
.SH "AUTHORS"
.IX Header "AUTHORS"
Adam Kennedy <adamk@cpan.org>
.PP
Sean M. Burke <sburke@cpan.org>
.PP
Chris Nandor <cnandor@cpan.org>
.PP
Stephen Steneker <stennie@cpan.org>
.SH "SEE ALSO"
.IX Header "SEE ALSO"
File::ShareDir, File::HomeDir::Win32 (legacy)
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
Copyright 2005 \- 2012 Adam Kennedy.
.PP
Some parts copyright 2000 Sean M. Burke.
.PP
Some parts copyright 2006 Chris Nandor.
.PP
Some parts copyright 2006 Stephen Steneker.
.PP
Some parts copyright 2009\-2011 Je\*'ro\*^me Quelin.
.PP
This program is free software; you can redistribute
it and/or modify it under the same terms as Perl itself.
.PP
The full text of the license can be found in the
\&\s-1LICENSE\s0 file included with this module.
.SH "POD ERRORS"
.IX Header "POD ERRORS"
Hey! \fBThe above document had some coding errors, which are explained below:\fR
.IP "Around line 712:" 4
.IX Item "Around line 712:"
Non-ASCII character seen before =encoding in 'Je\*'ro\*^me'. Assuming \s-1UTF\-8\s0
