SYNOPSIS

  use User;

  my $cfg = Config::IniFiles->new
        (
          -file    => sprintf("%s/%s", User->Home, ".ncfg"),
          -default => 'Default'
        );

  print "Your login is ", User->Login, "\n";

DESCRIPTION

This module is allows applications to retrieve per-user characteristics.

METHODS

Home

Returns a location that can be expected to be a users \*(L"Home\*(R" directory on either Windows or Unix. While one way of writing this would be to check for operating system and then check the expected location for an operation system of that type, I chose to do the following: sub Home {

return $ENV{HOME} if $ENV{HOME}; return $ENV{USERPROFILE} if $ENV{USERPROFILE}; return "";

} In other words, if $HOME is defined in the user's environment, then that is used. Otherwise $USERPROFILE is used. Otherwise "" is returned. A contribution for Macintosh (or any other number of OS/arch combinations) is greatly solicited.

Login

Returns login id of user on either Unix or \s-1NT\s0 by checking \*(C`getlogin\*(C', \*(C`getpwuid\*(C', and various environment variables.

RELATED TO User…

File::HomeDir seems to be a very well-done update of the same concept as this module.

COPYRIGHT INFO

Copyright: Copyright (c) 2002-2010 Terrence Brannon. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

License: \s-1GPL\s0, Artistic, available in the Debian Linux Distribution at /usr/share/common-licenses/{\s-1GPL\s0,Artistic}

AUTHOR

T.M. Brannon, [email protected]

I am grateful for additions by Rob Napier and Malcom Nooning.

ACKNOWLEDGEMENTS

I would like to offer profuse thanks to my fellow perl monk at www.perlmonks.org, the_slycer, who told me where \s-1HOME\s0 could be found on Windows machines.

I would also like to thank Bob Armstrong for providing me with the text of the copyright notice and for including this in the Debian Linux distribution.

perl\|(1).