User-1.9/0000755000175000017500000000000011402007662012503 5ustar metaperlmetaperlUser-1.9/Changes0000644000175000017500000000022207252262344014002 0ustar metaperlmetaperlRevision history for Perl extension User. 0.01 Tue Oct 17 08:11:26 2000 - original version; created by h2xs 1.20 with options -A -X -n User User-1.9/Makefile.PL0000644000175000017500000000043007252262344014462 0ustar metaperlmetaperluse ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. WriteMakefile( 'NAME' => 'User', 'VERSION_FROM' => 'User.pm', # finds $VERSION 'PREREQ_PM' => {}, # e.g., Module::Name => 1.1 ); User-1.9/META.yml0000644000175000017500000000071511402007662013757 0ustar metaperlmetaperl--- #YAML:1.0 name: User version: 1.9 abstract: ~ author: [] license: unknown distribution_type: module configure_requires: ExtUtils::MakeMaker: 0 build_requires: ExtUtils::MakeMaker: 0 requires: {} no_index: directory: - t - inc generated_by: ExtUtils::MakeMaker version 6.56 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 User-1.9/User.pm0000644000175000017500000000473711402007562013771 0ustar metaperlmetaperlpackage User; use strict; use vars qw(@ISA $VERSION); $VERSION = '1.9'; # Preloaded methods go here. sub Home { return $ENV{HOME} if $ENV{HOME}; return $ENV{USERPROFILE} if $ENV{USERPROFILE}; return ""; } sub Login { return getlogin || getpwuid( $< ) || $ENV{ LOGNAME } || $ENV{ USER } || $ENV{ USERNAME } || 'unknown'; } 1; __END__ # Below is stub documentation for your module. You better edit it! =head1 NAME User - API for locating user information regardless of OS =head1 SYNOPSIS use User; my $cfg = Config::IniFiles->new ( -file => sprintf("%s/%s", User->Home, ".ncfg"), -default => 'Default' ); print "Your login is ", User->Login, "\n"; =head1 DESCRIPTION This module is allows applications to retrieve per-user characteristics. =head1 METHODS =over 4 =item Home 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 $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. =item Login Returns login id of user on either Unix or NT by checking C, C, and various environment variables. =back =head1 SEE ALSO L seems to be a very well-done update of the same concept as this module. =head1 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: GPL, Artistic, available in the Debian Linux Distribution at /usr/share/common-licenses/{GPL,Artistic} =head1 AUTHOR T.M. Brannon, tbone@cpan.org I am grateful for additions by Rob Napier and Malcom Nooning. =head1 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 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). =cut User-1.9/test.pl0000644000175000017500000000104610611473642014026 0ustar metaperlmetaperl# Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' use strict; use Test; BEGIN { plan tests => 3 } use User; use Cwd qw( getcwd abs_path); # Test 1: Check out Home using chdir() my $oldpwd = getcwd; $ENV{HOME} = $ENV{USERPROFILE} if ($^O eq 'MSWin32'); chdir(); ok( abs_path( User->Home ), getcwd ); chdir( $oldpwd ); # Test 2: Make sure Login returns something ok( User->Login ); # Test 3: Make sure Login isn't unknown ok( User->Login ne 'unknown' ); User-1.9/MANIFEST0000644000175000017500000000017410611473703013642 0ustar metaperlmetaperlChanges MANIFEST Makefile.PL User.pm test.pl META.yml Module meta-data (added by MakeMaker)