Meta

 view release on metacpan or  search on metacpan

Meta/Utils/Utils.pm  view on Meta::CPAN

	return($sub eq $suff);
}

sub cuid() {
	return(POSIX::getuid());
#	return($>);
}

sub cuname() {
	my($uid)=POSIX::getuid();
	return((POSIX::getpwuid($uid))[0]);
}

sub cgid() {
	return(POSIX::getegid());
}

sub get_home_dir() {
	my($uid)=POSIX::getuid();
	return((POSIX::getpwuid($uid))[7]);
	#my($user)=POSIX::getpwnam();
	#return(get_user_home_dir($user));
#	return(Meta::Utils::Env::get("HOME"));
}

sub get_user_home_dir($) {
	my($user)=@_;
	my($resu)=((POSIX::getpwnam($user))[7]);
	if(!defined($resu)) {
		throw Meta::Error::Simple("user [".$user."] unknown");

Meta/Utils/Utils.pm  view on Meta::CPAN

This routine returns the numerical value of the current group (gid).
I don't think there is a cleaner way to do this.

=item B<get_home_dir()>

This routine returns the current users home directory.
The implementation used to work with the environment and getting the
HOME variable but this is very unrobust and works for less platforms
and situations. Currently this uses POSIX which is much more robust
to find the uid of the current user and then the home directory from
the password file using getpwuid. The reason that this does not use
the get_user_home_dir method from this same module is that there is
no convinient way to get the current user name (it would take
another function to convert uid to uname). The implementation marked
out using POSIX::getpwnam does not work.

=item B<get_user_home_dir($)>

This routine returns the home dir of the user that is given to it as the
argument.



( run in 0.320 second using v1.01-cache-2.11-cpan-8d75d55dd25 )