User
view release on metacpan or search on metacpan
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
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<getlogin>,
C<getpwuid>, and various environment variables.
=back
=head1 SEE ALSO
L<File::HomeDir> seems to be a very well-done update of the same concept as this module.
=head1 COPYRIGHT INFO
( run in 0.280 second using v1.01-cache-2.11-cpan-8d75d55dd25 )