view release on metacpan or search on metacpan
t/05-steps.t view on Meta::CPAN
is_deeply([File::Finder->not->group(0+$()->in(qw(.))],
[fin(sub { $( != (stat)[5] }, '.')],
'not group');
is_deeply([File::Finder->nouser->in(qw(.))],
[fin(sub { not defined getpwuid((stat)[4]) }, '.')],
'nouser');
is_deeply([File::Finder->not->nouser->in(qw(.))],
[fin(sub { defined getpwuid((stat)[4]) }, '.')],
'not nouser');
is_deeply([File::Finder->nogroup->in(qw(.))],
[fin(sub { not defined getgrgid((stat)[5]) }, '.')],
'nogroup');
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/HomeDir/MacOS9.pm view on Meta::CPAN
}
# Desperation on any platform
SCOPE:
{
# On some platforms getpwuid dies if called at all
local $SIG{'__DIE__'} = '';
my $home = (getpwuid($<))[7];
return $home if $home and -d $home;
}
Carp::croak("Could not locate current user's home directory");
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/Information.pm view on Meta::CPAN
return $self->{home} = $home if length($home);
}
return $self->{home} = 'C:\\';
} else {
return $self->{home} = $home if defined($home = $ENV{HOME}) && length($home);
return $self->{home} = $home if defined($home = eval { [getpwuid($>)]->[7] }) && length($home);
return $self->{home} = File::Spec->rootdir;
}
croak 'BUG';
}
view all matches for this distribution
view release on metacpan or search on metacpan
GETPWENT_R_PROTO|5.008000|5.008000|Vn
getpwnam|5.009000||Viu
GETPWNAM_R_HAS_BUFFER|5.008000||Viu
GETPWNAM_R_HAS_PTR|5.008000||Viu
GETPWNAM_R_PROTO|5.008000|5.008000|Vn
getpwuid|5.009000||Viu
GETPWUID_R_HAS_PTR|5.008000||Viu
GETPWUID_R_PROTO|5.008000|5.008000|Vn
get_quantifier_value|5.033006||Viu
get_re_arg|||xciu
get_re_gclass_nonbitmap_data|5.031011||Viu
KEY_getprotobyname|5.003007||Viu
KEY_getprotobynumber|5.003007||Viu
KEY_getprotoent|5.003007||Viu
KEY_getpwent|5.003007||Viu
KEY_getpwnam|5.003007||Viu
KEY_getpwuid|5.003007||Viu
KEY_getservbyname|5.003007||Viu
KEY_getservbyport|5.003007||Viu
KEY_getservent|5.003007||Viu
KEY_getsockname|5.003007||Viu
KEY_getsockopt|5.003007||Viu
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/KeePass/Agent/unix.pm view on Meta::CPAN
$out =~ s{~/}{$self->home_dir.'/'}e;
return length($out) ? $out : $def;
}
sub home_dir {
my ($user,$passwd,$uid,$gid,$quota,$comment,$gcos,$home,$shell,$expire) = getpwuid($<);
return $home || croak "Couldn't find home dir for uid $<";
}
sub _config_file {
my $self = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
GETPWENT_R_PROTO|5.008000|5.008000|Vn
getpwnam|5.009000||Viu
GETPWNAM_R_HAS_BUFFER|5.008000||Viu
GETPWNAM_R_HAS_PTR|5.008000||Viu
GETPWNAM_R_PROTO|5.008000|5.008000|Vn
getpwuid|5.009000||Viu
GETPWUID_R_HAS_PTR|5.008000||Viu
GETPWUID_R_PROTO|5.008000|5.008000|Vn
get_re_arg|||xciu
get_re_gclass_nonbitmap_data|5.031010||Viu
get_regclass_nonbitmap_data|5.031010||Viu
KEY_getprotobyname|5.003007||Viu
KEY_getprotobynumber|5.003007||Viu
KEY_getprotoent|5.003007||Viu
KEY_getpwent|5.003007||Viu
KEY_getpwnam|5.003007||Viu
KEY_getpwuid|5.003007||Viu
KEY_getservbyname|5.003007||Viu
KEY_getservbyport|5.003007||Viu
KEY_getservent|5.003007||Viu
KEY_getsockname|5.003007||Viu
KEY_getsockopt|5.003007||Viu
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/ppport.h view on Meta::CPAN
GETPWENT_R_PROTO|5.008000|5.008000|Vn
getpwnam|5.009000||Viu
GETPWNAM_R_HAS_BUFFER|5.008000||Viu
GETPWNAM_R_HAS_PTR|5.008000||Viu
GETPWNAM_R_PROTO|5.008000|5.008000|Vn
getpwuid|5.009000||Viu
GETPWUID_R_HAS_PTR|5.008000||Viu
GETPWUID_R_PROTO|5.008000|5.008000|Vn
get_quantifier_value|5.033006||Viu
get_re_arg|||xciu
get_re_gclass_nonbitmap_data|5.031011||Viu
lib/File/ppport.h view on Meta::CPAN
KEY_getprotobyname|5.003007||Viu
KEY_getprotobynumber|5.003007||Viu
KEY_getprotoent|5.003007||Viu
KEY_getpwent|5.003007||Viu
KEY_getpwnam|5.003007||Viu
KEY_getpwuid|5.003007||Viu
KEY_getservbyname|5.003007||Viu
KEY_getservbyport|5.003007||Viu
KEY_getservent|5.003007||Viu
KEY_getsockname|5.003007||Viu
KEY_getsockopt|5.003007||Viu
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/OSS/Scan.pm view on Meta::CPAN
working_dir => getcwd() . "\/\.working",
inflate => UNI_FALSE,
);
my $options = undef;
my $user = getlogin() || ( getpwuid $< )[0];
sub scan_init {
my %params = ( scalar(@_) != 1 ) ? @_ : ( 'ruleset_config' => $_[0] );
# convert hash keys to lower case
view all matches for this distribution
view release on metacpan or search on metacpan
xt/setup_tests.pl view on Meta::CPAN
die 'Must provide uid of the user running tests as non-root'
if not defined $opt{u};
my ($uid, $gid) = $opt{u} =~ /\D/
? (getpwnam($opt{u}))[2,3]
: (getpwuid($opt{u}))[2,3]
;
create_dir($d, 0755);
# directory EXTRA/1 could be deleted by a
view all matches for this distribution
view release on metacpan or search on metacpan
script/rsybak view on Meta::CPAN
# my ($user, $slash) = @_;
# my @ent;
# if (length $user) {
# @ent = getpwnam($user);
# } else {
# @ent = getpwuid($>);
# $user = $ent[0];
# }
# return $ent[7] . $slash if @ent;
# "~$user$slash";
#}
script/rsybak view on Meta::CPAN
# if ($^O eq 'MSWin32') {
# return $ENV{USERNAME};
# } else {
# return $ENV{USER} if $ENV{USER};
# my @pw;
# eval { @pw = getpwuid($>) };
# return $pw[0] if @pw;
# }
#}
#
#sub _get_my_home_dir {
script/rsybak view on Meta::CPAN
# return join($ENV{HOMEDRIVE}, "\\", $ENV{HOMEPATH})
# if $ENV{HOMEDRIVE} && $ENV{HOMEPATH};
# } else {
# return $ENV{HOME} if $ENV{HOME};
# my @pw;
# eval { @pw = getpwuid($>) };
# return $pw[7] if @pw;
# }
#
# die "Can't get home directory";
#}
script/rsybak view on Meta::CPAN
# my ($name) = @_;
#
# if ($^O eq 'MSWin32') {
# return undef;
# } else {
# if ($name eq getpwuid($<)) {
# return _get_my_home_dir();
# }
#
# SCOPE: {
# my $home = (getpwnam($name))[7];
script/rsybak view on Meta::CPAN
# return join($ENV{HOMEDRIVE}, "\\", $ENV{HOMEPATH})
# if $ENV{HOMEDRIVE} && $ENV{HOMEPATH};
# } else {
# return $ENV{HOME} if $ENV{HOME};
# my @pw;
# eval { @pw = getpwuid($>) };
# return $pw[7] if @pw;
# }
#
# if ($DIE_ON_FAILURE) {
# die "Can't get home directory";
script/rsybak view on Meta::CPAN
# my ($name) = @_;
#
# if ($^O eq 'MSWin32') {
# return undef;
# } else {
# if ($name eq getpwuid($<)) {
# return get_my_home_dir();
# }
#
# SCOPE: {
# my $home = (getpwnam($name))[7];
script/rsybak view on Meta::CPAN
# return join($ENV{HOMEDRIVE}, "\\", $ENV{HOMEPATH})
# if $ENV{HOMEDRIVE} && $ENV{HOMEPATH};
# } else {
# return $ENV{HOME} if $ENV{HOME};
# my @pw;
# eval { @pw = getpwuid($>) };
# return $pw[7] if @pw;
# }
# die "Can't get home directory";
#}
#
view all matches for this distribution
view release on metacpan or search on metacpan
my $fn = shift;
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks) = lstat $fn;
my @a = lstat $fn;
my $dft = "%b %d %Y";
my $ud = getpwuid($uid);
my $gd = getgrgid($gid);
my $fm = format_mode($mode);
my $mt = strftime $dft,localtime $mtime;
my $fmt = "%10s %3d %7s %4s %12d %12s %-26s\n";
return sprintf $fmt, $fm,$nlink,$ud,$gd,$size,$mt,$fn;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/Stat/OO.pm view on Meta::CPAN
}
}
sub owner {
my $self = shift;
return (getpwuid($self->uid))[0];
}
sub group {
my $self = shift;
return (getgrgid($self->gid))[0];
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/Tools.pm view on Meta::CPAN
Normally the id command shows the current username, userid, group and gid.
In Perl one can access the current ireal UID as $< and the effective UID as $>.
The real GID is $( and the effective GID is $) of the current user.
To get the username and the group name use the getpwuid($uid) and getpwgrid($gid)
functions respectively in scalar context.
=cut
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/Valet.pm view on Meta::CPAN
elsif (defined $username) {
$env_home = $home_drive . '\\Users\\' . $username;
}
return $env_home if (defined $env_home && -d $env_home);
} else {
my @row = getpwuid($<);
if (@row >= 9) {
my $home_dir = $row[7];
return $home_dir if (defined $home_dir && -d $home_dir);
}
return '/root' if (-d '/root' && -w '/root');
view all matches for this distribution
view release on metacpan or search on metacpan
lib/File/XDG.pm view on Meta::CPAN
$self->{config} = $ENV{XDG_CONFIG_HOME} || "$local\\.config\\";
$self->{state} = $ENV{XDG_STATE_HOME} || "$local\\.local\\state\\";
$self->{data_dirs} = $ENV{XDG_DATA_DIRS} || '';
$self->{config_dirs} = $ENV{XDG_CONFIG_DIRS} || '';
} else {
my $home = $ENV{HOME} || [getpwuid($>)]->[7];
$self->{home} = $home;
$self->{data} = $ENV{XDG_DATA_HOME} || "$home/.local/share/";
$self->{cache} = $ENV{XDG_CACHE_HOME} || "$home/.cache/";
$self->{state} = $ENV{XDG_STATE_HOME} || "$home/.local/state/";
$self->{config} = $ENV{XDG_CONFIG_HOME} || "$home/.config/";
view all matches for this distribution
view release on metacpan or search on metacpan
@alts= m#(^|[^\\])(\\\\)*\{# ? &unbrac( $_ ) : ( $_ ); #}
foreach( @alts ) {
if( m#^~([^/]+)# ) { # Expand ~user to user's home directory:
$user= $1 || getlogin(); # ~/ means "my" home directory
$home= $1 ? ( (getpwnam($1))[7] || "~$user" )
: ( (getpwuid($<))[7] || $ENV{'HOME'} || "/" );
s##$home#;
# Replace "~user" with user's home directory (unless no such
# user, then leave as is), unless is "~/" and getlogin()
# failed, then try by current UID then $HOME then "/".
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Filesys/CygwinPaths.pm view on Meta::CPAN
Carp::croak "Cannot understand your arg: $_[0] -- " unless
$homey[0] =~/^~\w*\z/;
# pattern ' m/^~(\w+)?/ ' is tilde with optional username
$homey[0] =~ s%^~(\w*)%$1 ?
((getpwnam($1))[7] || "~$1")
: (getpwuid($>))[7]
%ex;
return join( $pathsep, $homey[0],$homey[1] );
}
sub vetted_path {
view all matches for this distribution
view release on metacpan or search on metacpan
]
);
}
sub ui {
($u{$_[0]} ||= getpwuid($_[0]) || $_[0]),
($g{$_[1]} ||= getgrgid($_[1]) || $_[1]);
}
sub format_time {
return $time{$_[0]} if exists $time{$_[0]};
view all matches for this distribution
view release on metacpan or search on metacpan
easyxs/ppport.h view on Meta::CPAN
GETPWENT_R_PROTO|5.008000|5.008000|Vn
getpwnam|5.009000||Viu
GETPWNAM_R_HAS_BUFFER|5.008000||Viu
GETPWNAM_R_HAS_PTR|5.008000||Viu
GETPWNAM_R_PROTO|5.008000|5.008000|Vn
getpwuid|5.009000||Viu
GETPWUID_R_HAS_PTR|5.008000||Viu
GETPWUID_R_PROTO|5.008000|5.008000|Vn
get_quantifier_value|5.033006||Viu
get_re_arg|||xciu
get_re_gclass_nonbitmap_data|5.031011||Viu
easyxs/ppport.h view on Meta::CPAN
KEY_getprotobyname|5.003007||Viu
KEY_getprotobynumber|5.003007||Viu
KEY_getprotoent|5.003007||Viu
KEY_getpwent|5.003007||Viu
KEY_getpwnam|5.003007||Viu
KEY_getpwuid|5.003007||Viu
KEY_getservbyname|5.003007||Viu
KEY_getservbyport|5.003007||Viu
KEY_getservent|5.003007||Viu
KEY_getsockname|5.003007||Viu
KEY_getsockopt|5.003007||Viu
view all matches for this distribution
view release on metacpan or search on metacpan
my %user;
sub _user {
my ($self, $uid) = @_;
if (!exists($user{$uid})) {
if (defined($uid)) {
my $obj = getpwuid($uid);
if ($obj) {
$user{$uid} = $obj->name;
} else {
$user{$uid} = "#$uid";
}
view all matches for this distribution
view release on metacpan or search on metacpan
scripts/FINANCE_QUANT_CACHE view on Meta::CPAN
sub tildeexp {
my $path = shift;
$path =~ s{^~([^/]*)} {
$1
? (getpwnam($1))[7]
: ( $ENV{HOME} || $ENV{LOGDIR} || (getpwuid($>))[7])
}ex;
return $path;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Firefox/Marionette.pm view on Meta::CPAN
if ( defined $parameters{host} ) {
if ( $OSNAME eq 'MSWin32' ) {
$parameters{user} ||= Win32::LoginName();
}
else {
$parameters{user} ||= getpwuid $EFFECTIVE_USER_ID;
}
if ( $parameters{host} =~ s/:(\d+)$//smx ) {
$parameters{port} = $1;
}
$parameters{port} ||= scalar getservbyname 'ssh', 'tcp';
lib/Firefox/Marionette.pm view on Meta::CPAN
{
$user = Win32::LoginName();
$host = 'localhost';
}
else {
$user = getpwuid $EFFECTIVE_USER_ID;
$host = 'localhost';
}
my $quoted_user = defined $user ? quotemeta $user : q[];
if ( $self->_ssh() ) {
$self->_initialise_remote_uname();
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Flux/File.pm view on Meta::CPAN
}
sub owner {
my ($self) = @_;
if (-e $self->file) {
return scalar getpwuid( (stat($self->file))[4] );
}
else {
return scalar getpwuid($>);
}
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Chj/xhome.pm view on Meta::CPAN
In taint mode, is tainted.
=item xeffectiveuserhome ()
Just the getpwuid setting. Throws unimplemented exception on Windows
(Raspberry, not Cygwin Perl).
Is not tainted.
=item xsafehome ()
lib/Chj/xhome.pm view on Meta::CPAN
my $uid = $>;
my (
$name, $passwd, $_uid, $gid, $quota,
$comment, $gcos, $dir, $shell, $expire
)
= getpwuid $uid
or die "unknown user for uid $uid";
$dir
}
sub xsafehome {
lib/Chj/xhome.pm view on Meta::CPAN
my ($home, $what) = @_;
xcheck_home $home;
if (-d $home) {
$home
} else {
warn "$what: dir '$home' does not exist, falling back to getpwuid"
unless $warned++;
undef
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Egbk.pm view on Meta::CPAN
### More-desperate methods
# Light desperation on any (Unixish) platform
else {
$home = CORE::eval q{ (getpwuid($<))[7] };
}
# On Unix in general, a non-existant home means "no home"
# For example, "nobody"-like users might use /nonexistant
if (defined $home and ! Egbk::d($home)) {
view all matches for this distribution
view release on metacpan or search on metacpan
bin/gbrowse_metadb_config.pl view on Meta::CPAN
and password that has database create privileges on the server.
EOF
;
my $www_user = GBrowse::ConfigData->config('wwwuser');
my ($current_user) = getpwuid($<);
unless ($www_user eq $current_user or $< == 0) {
print STDERR <<END;
For user account installation to work properly, this script must be able to
create directories owned by the Apache server account ($www_user).
bin/gbrowse_metadb_config.pl view on Meta::CPAN
} else {
print STDERR "Using sudo to create $parent directory. You may be prompted for your login password now.\n";
system "sudo mkdir $parent";
}
}
my $file_owner = -e $path ? getpwuid((stat($path))[4]) : '';
my $dir_owner = -e $dir ? getpwuid((stat($dir))[4]) : '';
# Check if we need to, to avoid unnecessary printing/sudos.
unless ($group) {
print STDERR "Unable to look up group for $user. Will not change ownerships on $path.\n";
print STDERR "You should do this manually to give the Apache web server read/write access to $path.\n";
bin/gbrowse_metadb_config.pl view on Meta::CPAN
return $ans;
}
sub get_group_from_user {
my $user = shift;
my (undef,undef,undef,$gid) = $user =~ /^\d+$/ ? getpwuid($user)
: getpwnam($user);
$gid or return;
my $group = getgrgid($gid);
return $group;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Term/GDBUI.pm view on Meta::CPAN
);
# expand tildes in the history file
if($args{history_file}) {
$args{history_file} =~ s/^~([^\/]*)/$1?(getpwnam($1))[7]:
$ENV{HOME}||$ENV{LOGDIR}||(getpwuid($>))[7]/e;
}
for(keys %args) {
next if $_ eq 'app'; # this param is not a member
$self->{$_} = $args{$_};
view all matches for this distribution
view release on metacpan or search on metacpan
my $setme = shift;
# We assume that if we could get this far, then /tmp/orit-$username
# is already secured (because of CORBA_ORB_init)
my $pwname = getpwuid($<);
# my $name = "/tmp/orbit-$pwname/cookie";
my $name = "/tmp/orbit-cookie";
if (defined $setme) {
if (!sysopen COOKIEFILE, $name, O_CREAT | O_WRONLY, 0600) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Gantry/Control.pm view on Meta::CPAN
my ( $id, $passwd, $first, $last, $email, $active ) = db_next( $sth );
db_finish( $sth );
# act like C's getpwuid
return( $id || 0, $active || 0, $passwd || '', $first || '',
$last || '', $email || '' );
} # END get_pwnam
#-------------------------------------------------
lib/Gantry/Control.pm view on Meta::CPAN
my ( $uname, $passwd, $first, $last, $email, $active ) = db_next( $sth );
db_finish( $sth );
# act like C's getpwuid
return( $uname || '', $active || 0, $passwd || '', $first || '',
$last || '', $email || '' );
} # END get_pwuid
#-------------------------------------------------
lib/Gantry/Control.pm view on Meta::CPAN
status of the user, the users password ( as kept in the database ), the
users first name, the users last name, and the users email address.
=item @user_info = get_pwuid( $dbh, $user_id )
This emulates C's getpwuid save it operates on the database. The return
values are, in this order: Users username, a boolean for the active
status of the user, the users password ( as kept in the database ), the
users first name, the users last name, and the users email address.
=item $grp = get_usrgrp( $dbh, $uid )
view all matches for this distribution
view release on metacpan or search on metacpan
News/Gateway.in view on Meta::CPAN
# to articles.
sub new {
my $that = shift;
my $class = ref $that || $that;
my ($interactive, $maintainer, $envelope) = @_;
unless ($maintainer) { $maintainer = (getpwuid ($<))[0] }
unless ($envelope) { $envelope = $maintainer }
my $self = {
confhooks => {},
mesghooks => [],
envelope => $envelope,
view all matches for this distribution