SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG
DONATE


YUM REPOSITORY

 
 

User

Section: User Contributed Perl Documentation (3)
Updated: 2007-04-18
Index 

NAME

User - API for locating user information regardless of OS 

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 ``Home'' directoryon either Windows or Unix.

While one way of writing this would be to check for operating systemand 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, thenthat is used. Otherwise $USERPROFILE is used. Otherwise "" is returned.

A contribution for Macintosh (or any other number of OS/arch combinations) isgreatly solicited.

Login
Returns login id of user on either Unix or NT by checking "getlogin","getpwuid", and various environment variables.
 

EXPORT

None by default. 

COPYRIGHT INFO

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

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

AUTHOR

T.M. Brannon, tboneAATTcpan.org

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 HOME could befound on Windows machines.

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

perl(1).


 

Index

NAME
SYNOPSIS
DESCRIPTION
METHODS
EXPORT
COPYRIGHT INFO
AUTHOR
ACKNOWLEDGEMENTS

This document was created byman2html,using the manual pages.