Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages
User(3) User Contributed Perl Documentation User(3)

User - API for locating user information regardless of OS

  use User;
  my $cfg = Config::IniFiles->new
          -file    => sprintf("%s/%s", User->Home, ".ncfg"),
          -default => 'Default'
  print "Your login is ", User->Login, "\n";

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

Returns a location that can be expected to be a users "Home" 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  "";
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.
Returns login id of user on either Unix or NT by checking "getlogin", "getpwuid", and various environment variables.

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

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: GPL, Artistic, available in the Debian Linux Distribution at /usr/share/common-licenses/{GPL,Artistic}

T.M. Brannon,
I am grateful for additions by Rob Napier and Malcom Nooning.

I would like to offer profuse thanks to my fellow perl monk at, the_slycer, who told me where HOME 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.
2010-06-03 perl v5.28.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.