view release on metacpan or search on metacpan
lib/App/BLT.pm view on Meta::CPAN
already_running_in_background
$check $set $help $version $force $sync $check_public $username
%rc_settings $timeline $last_fetch_filename $home $pid_filename
$rc_filename $last_fetch);
our $home = $ENV{HOME} || (getpwuid($<))[7];
our $rc_filename = "$home/.bltrc.xml";
our $pid_filename = "$home/.blt_pid";
our $last_fetch_filename = "$home/.blt_last_fetch";
our $timeline;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/cPanel/PublicAPI.pm view on Meta::CPAN
if ( $OPTS{'user'} ) {
$self->{'user'} = $OPTS{'user'};
$self->debug("Using user param from object creation") if $self->{'debug'};
}
else {
$self->{'user'} = exists $INC{'Cpanel/PwCache.pm'} ? ( Cpanel::PwCache::getpwuid($>) )[0] : ( getpwuid($>) )[0];
$self->debug("Setting user based on current uid ($>)") if $self->{'debug'};
}
if ( exists $OPTS{'api_token'} && exists $OPTS{'accesshash'} ) {
$self->error('You cannot specify both an accesshash and an API token');
lib/cPanel/PublicAPI.pm view on Meta::CPAN
# Allow the user to specify an api_token instead of an accesshash.
# Though, it will just act as a synonym.
$OPTS{'accesshash'} = $OPTS{'api_token'} if $OPTS{'api_token'};
if ( ( !exists( $OPTS{'pass'} ) || $OPTS{'pass'} eq '' ) && ( !exists $OPTS{'accesshash'} || $OPTS{'accesshash'} eq '' ) ) {
my $homedir = exists $INC{'Cpanel/PwCache.pm'} ? ( Cpanel::PwCache::getpwuid($>) )[7] : ( getpwuid($>) )[7];
$self->debug("Attempting to detect correct authentication credentials") if $self->{'debug'};
if ( -e $homedir . '/.accesshash' ) {
local $/;
if ( open( my $hash_fh, '<', $homedir . '/.accesshash' ) ) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/dtRdr/User.pm view on Meta::CPAN
ref($class) and croak("not an object method");
(@_%2) and croak("odd number of elements in argument list");
my (%attr) = @_;
unless(defined($attr{username})) {
$attr{username} = getlogin || getpwuid($<) || "Kilroy";
}
my $self = {
name => 'me',
%attr,
view all matches for this distribution
view release on metacpan or search on metacpan
use EC::ECIcon;
#
# Get user info
#
my $localuser = $^O =~ /Win/ ? $ENV{USERNAME} : (getpwuid ($<))[0] or
die "Could not determine your login name: $!\n";
#
# Path names for library files. Edit these for your configuration.
#
view all matches for this distribution
view release on metacpan or search on metacpan
mod/Apache/ePerl.pm view on Meta::CPAN
# determine script file information
@S = stat(_);
$size = $S[7];
$mtime = $S[9];
$owner = (getpwuid($S[4]))[0] || 'UNKNOWN';
# check cache for existing P-code
if (not ( $Cache->{$filename}
and $Cache->{$filename}->{CODE}
and $Cache->{$filename}->{SIZE} == $size
view all matches for this distribution
view release on metacpan or search on metacpan
}
} else {
$DEF_DOMAIN = 'unknown.domain'; ### CONFIGURE
}
chomp($DEF_DOMAIN);
$NAME = eval { (getpwuid($>))[6] } || $ENV{NAME} || "";
if($NAME =~ /[^\w\s]/) {
# $NAME =~ s/"/\"/g;
$NAME = '"' . $NAME . '"';
}
# These should all be my ...
view all matches for this distribution
view release on metacpan or search on metacpan
}
argc -= optind;
argv += optind;
if (!(pw = getpwuid(uid = getuid()))) {
(void)fprintf(stderr, "rsh: unknown user id.\n");
exit(1);
}
if (!user)
user = pw->pw_name;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Git/Deploy/Say.pm view on Meta::CPAN
sub __log {
return if $SKIP_LOGING_DUE_TO_DEEP_RECURSION_WITH_GIT_DEPLOY_DEBUG;
my $str= join("",@_);
my $user = $ENV{USER} || ((getpwuid($<))[0]);
my $pfx= sprintf "# %-12s | %s #",$user,strftime("%Y-%m-%d %H:%M:%S",localtime);
$str=~s/\033\[[^m]+m//g; # strip color
$str=~s/^#([^:]+):/$pfx $1:/mg; # fix prefix
$str=~s/\n*\z/\n/;
if (my $fh= _get_log_handle()) {
view all matches for this distribution
view release on metacpan or search on metacpan
src/os/aix/aix_sigar.c view on Meta::CPAN
proccred->uid = pinfo->pi_cred.cr_ruid;
proccred->euid = pinfo->pi_cred.cr_uid;
if (proccred->uid == -1) {
/*
* aix 5.2 has a process named 'jfsz'
* where uid is '-1', getpwuid returns EPERM
*/
proccred->uid = proccred->euid = 0;
}
proccred->gid = pinfo->pi_cred.cr_rgid;
proccred->egid = pinfo->pi_cred.cr_gid;
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module-Build/Module/Build/Platform/Unix.pm view on Meta::CPAN
sub _detildefy {
my ($self, $value) = @_;
$value =~ s[^~([^/]+)?(?=/|$)] # tilde with optional username
[$1 ?
((getpwnam $1)[7] || "~$1") :
($ENV{HOME} || (getpwuid $>)[7])
]ex;
return $value;
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/kateb/LocalData.pm view on Meta::CPAN
#----------------------- GLOBAL VARIABLES -----------------------#
# create empty envs
my $json_file;
# Home directory
my $home_dir = $ENV{HOME} || $ENV{LOGDIR} || (getpwuid $<)[7] || `echo -n ~`;
# Configuration directory
my $config_dir = catdir($ENV{XDG_CONFIG_HOME} || catdir($home_dir, '.config'), $execname);
# download fonts directory
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib-restrict.t view on Meta::CPAN
@lib::ORIG_INC = @lib::ORIG_INC; # to avoid warning..
is_deeply(\@lib::ORIG_INC, \@lib::restrict::ORIG_INC, 'name space ORIG_INC');
SKIP: {
skip q{lib::restrict's tests need to be run as root}, $skip if $> != 0;
skip q{Couldn't find valid non-root uid for testing}, $skip if !getpwuid($uuid);
# setup
mkdir $_ for @dirs;
chown $uuid, $uuid, qw(lib_restrict_array_ok_y lib_restrict_array_bad_y lib_restrict_user);
no warnings 'uninitialized'; # $INC{1} is uninit @ times below
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Net/Config.pm view on Meta::CPAN
%NetConfig = (%NetConfig, %{$ref});
$LIBNET_CFG = $file;
}
}
if ($< == $> and !$CONFIGURE) {
my $home = eval { local $SIG{__DIE__}; (getpwuid($>))[7] } || $ENV{HOME};
$home ||= $ENV{HOMEDRIVE} . ($ENV{HOMEPATH} || '') if defined $ENV{HOMEDRIVE};
if (defined $home) {
$file = $home . "/.libnetrc";
$ref = eval { local $SIG{__DIE__}; do $file } if -f $file;
%NetConfig = (%NetConfig, %{$ref})
view all matches for this distribution
view release on metacpan or search on metacpan
Mpp/BuildCacheControl.pm view on Meta::CPAN
$sep = "MODE EL ${grtitle}UID BI-UID SIZE ${timetype}D ${timetype}DATE ${timetype}TIME MEMBER\n"
unless $Mpp::verbose;
groupfind {
return if $deletable && ($combined_lstat[EXTLINK] && defined $combined_lstat[BIUID])
or defined $pattern && !/$pattern/;
$_ = defined() ? $user{$_} ||= getpwuid( $_ ) || $_ : '-'
for @combined_lstat[UID, BIUID];
if( defined $sep ) {
print $sep;
undef $sep;
}
Mpp/BuildCacheControl.pm view on Meta::CPAN
if( $Mpp::verbose > 1 ) { # Show each individual member.
for( my $i = 0; $i < @lstats; $i++ ) {
next unless defined $lstats[$i];
my $file = "$_[0][$i]/$_";
if( ref $lstats[$i] ) { # Normal file
$_ = defined() ? $user{$_} ||= getpwuid( $_ ) || $_ : '-'
for @{$lstats[$i]}[UID, BIUID];
showfull $lstats[$i], $file, $time;
} else {
print "$file -> " . readlink( $file ) . "\n";
}
view all matches for this distribution
view release on metacpan or search on metacpan
Sjis/0.93 2013-12-29 00:00:00
- fix quoting after filetest operators
- Esjis::unlink() deletes read only file too
- remove PERL5.BATes
- remove strict.pm_, warnings.pm_, warnings/register.pm_, and feature.pm_
- truncate(), getpwnam(), and getpwuid() into eval q{}
- consider Win95Cmd.exe by PERL5SHELL
- remove $ENV{'COMSPEC'}
- changed condition for escaping script
- support ActivePerl 5.18.1.1800 Windows (x86)
- support ActivePerl 5.18.1.1800 Windows (64-bit, x64)
view all matches for this distribution
view release on metacpan or search on metacpan
&::enum
($::TBCTL_INIT=0, $::TBCTL_ROW, $::TBCTL_COL, $::TBCTL_END,
$::TBCTL_HEAD);
# Provide defaults
local (@pw) = getpwuid ($<);
($::headers[$::HDR_MHID] = $ENV{"MMDS_ID"}
|| $cfg->gps("general.id", $pw[0])) =~ tr/[a-z]/[A-Z]/;
$::headers[$::HDR_AUTHOR] = $::headers[$::HDR_FROM] =
$ENV{"MMDS_FULLNAME"} || $ENV{"FULLNAME"}
|| $cfg->gps("general.author", $pw[6]);
local($[) = 0;
if ( $path =~ m|^~/| ) {
setpwent;
if ( defined ($home = $ENV{'HOME'} || $ENV{'LOGDIR'}
|| (getpwuid($>))[7]) ) {
$path = $home . '/' . $';
}
}
elsif ( $path =~ m|^~([^/]+)/| ) {
setpwent;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/MMM/Utils.pm view on Meta::CPAN
if ($user
&& ($> == 0 || $< == 0)) { # if we're not root, we can only ignore this
if ($user =~ /^\d+$/) {
$uid = $user;
my @uinfo = POSIX::getpwuid($uid);
if (!scalar(@uinfo)) {
return(undef, sprintf('User %s don\'t exists', $uid));
}
$gid = $uinfo[3];
} else {
view all matches for this distribution
view release on metacpan or search on metacpan
Apache-Test/lib/Apache/TestConfig.pm view on Meta::CPAN
sub default_user {
return if WINFU;
my $uid = $>;
my $user = $ENV{APACHE_TEST_USER} || (getpwuid($uid) || "#$uid");
if ($user eq 'root') {
my $other = (getpwnam('nobody'))[0];
if ($other) {
$user = $other;
view all matches for this distribution
view release on metacpan or search on metacpan
);
# these are not customizable at runtime!
$hardparams = "(readonly|maxlen|dbdriver|useencryption|cryptmethod)";
$CONF = File::Spec->catfile($ENV{HOME}, ".noterc");
$USER = getlogin || getpwuid($<); chomp $USER;
$TOPIC = 1;
$VERSION = "1.4.2";
$CurDepth = 1; # the current depth inside the topic "directory" structure...
$maxlen = "auto";
$timelen = 22;
view all matches for this distribution
view release on metacpan or search on metacpan
sub get_username
{
unless (&is_win32())
{
return ( getpwuid $< ) [0];
}
return "user";
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/oEdtk/Config.pm view on Meta::CPAN
# Get the DEFAULT and ENVDESC sections by default, override with the optional
# sections that we were given, and finally with the hostname section.
my %cfg = ();
$cfg{'EDTK_HOST'} = $uchost;
$cfg{'USERNAME'} = getlogin || getpwuid($<) || "undef";
foreach ('DEFAULT', 'ENVDESC', @$sections, $uchost) {
if (exists $allcfg{$_}) {
%cfg = ( %cfg, %{$allcfg{$_}} );
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Poros/Query.pm view on Meta::CPAN
die "invalid code\n" unless
-f ( $code = File::Spec->join( $path{code}, $code ) )
&& ( $code = do $code ) && ref $code eq 'CODE';
if ( ! $< && $user && $user ne ( getpwuid $< )[0] )
{
die "invalid user $user\n" unless my @pw = getpwnam $user;
@pw = map { 0 + sprintf '%d', $_ } @pw[2,3];
POSIX::setgid( $pw[1] ); ## setgid must preceed setuid
POSIX::setuid( $pw[0] );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/perfSONAR_PS/OWP.pm view on Meta::CPAN
or die "Can't getpwnam($unam): $!";
}
elsif ( $uid < 0 ) {
$uid = -$uid;
}
die("Invalid UID: $uid") if ( !getpwuid($uid) );
$> = $< = $uid;
return;
}
view all matches for this distribution
view release on metacpan or search on metacpan
cpan/Archive-Tar/lib/Archive/Tar/Constant.pm view on Meta::CPAN
use constant READ_ONLY => sub { shift() ? 'rb' : 'r' };
use constant WRITE_ONLY => sub { $_[0] ? 'wb' . shift : 'w' };
use constant MODE_READ => sub { $_[0] =~ /^r/ ? 1 : 0 };
# Pointless assignment to make -w shut up
my $getpwuid; $getpwuid = 'unknown' unless eval { my $f = getpwuid (0); };
my $getgrgid; $getgrgid = 'unknown' unless eval { my $f = getgrgid (0); };
use constant UNAME => sub { $getpwuid || scalar getpwuid( shift() ) || '' };
use constant GNAME => sub { $getgrgid || scalar getgrgid( shift() ) || '' };
use constant UID => $>;
use constant GID => (split ' ', $) )[0];
use constant MODE => do { 0666 & (0777 & ~umask) };
view all matches for this distribution
view release on metacpan or search on metacpan
"C:${SL}system${SL}temp");
unshift(@TEMP,$ENV{'TMPDIR'}) if defined $ENV{'TMPDIR'};
# this feature was supposed to provide per-user tmpfiles, but
# it is problematic.
# unshift(@TEMP,(getpwuid($<))[7].'/tmp') if $CGI::OS eq 'UNIX';
# Rob: getpwuid() is unfortunately UNIX specific. On brain dead OS'es this
# : can generate a 'getpwuid() not implemented' exception, even though
# : it's never called. Found under DOS/Win with the DJGPP perl port.
# : Refer to getpwuid() only at run-time if we're fortunate and have UNIX.
# unshift(@TEMP,(eval {(getpwuid($>))[7]}).'/tmp') if $CGI::OS eq 'UNIX' and $> != 0;
foreach (@TEMP) {
do {$TMPDIRECTORY = $_; last} if -d $_ && -w _;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
benchmarks/app/perlfunc.pod view on Meta::CPAN
=item Fetching user and group info
C<endgrent>, C<endhostent>, C<endnetent>, C<endpwent>, C<getgrent>,
C<getgrgid>, C<getgrnam>, C<getlogin>, C<getpwent>, C<getpwnam>,
C<getpwuid>, C<setgrent>, C<setpwent>
=item Fetching network info
C<endprotoent>, C<endservent>, C<gethostbyaddr>, C<gethostbyname>,
C<gethostent>, C<getnetbyaddr>, C<getnetbyname>, C<getnetent>,
benchmarks/app/perlfunc.pod view on Meta::CPAN
C<dbmclose>, C<dbmopen>, C<dump>, C<endgrent>, C<endhostent>,
C<endnetent>, C<endprotoent>, C<endpwent>, C<endservent>, C<exec>,
C<fcntl>, C<flock>, C<fork>, C<getgrent>, C<getgrgid>, C<gethostbyname>,
C<gethostent>, C<getlogin>, C<getnetbyaddr>, C<getnetbyname>, C<getnetent>,
C<getppid>, C<getpgrp>, C<getpriority>, C<getprotobynumber>,
C<getprotoent>, C<getpwent>, C<getpwnam>, C<getpwuid>,
C<getservbyport>, C<getservent>, C<getsockopt>, C<glob>, C<ioctl>,
C<kill>, C<link>, C<lstat>, C<msgctl>, C<msgget>, C<msgrcv>,
C<msgsnd>, C<open>, C<pipe>, C<readlink>, C<rename>, C<select>, C<semctl>,
C<semget>, C<semop>, C<setgrent>, C<sethostent>, C<setnetent>,
C<setpgrp>, C<setpriority>, C<setprotoent>, C<setpwent>,
benchmarks/app/perlfunc.pod view on Meta::CPAN
restrict what salts C<crypt()> accepts.
Here's an example that makes sure that whoever runs this program knows
their password:
$pwd = (getpwuid($<))[1];
system "stty -echo";
print "Password: ";
chomp($word = <STDIN>);
print "\n";
benchmarks/app/perlfunc.pod view on Meta::CPAN
=item getlogin
This implements the C library function of the same name, which on most
systems returns the current login from F</etc/utmp>, if any. If null,
use C<getpwuid>.
$login = getlogin || getpwuid($<) || "Kilroy";
Do not consider C<getlogin> for authentication: it is not as
secure as C<getpwuid>.
=item getpeername SOCKET
Returns the packed sockaddr address of other end of the SOCKET connection.
benchmarks/app/perlfunc.pod view on Meta::CPAN
=item getnetbyname NAME
=item getprotobyname NAME
=item getpwuid UID
=item getgrgid GID
=item getservbyname NAME,PROTO
benchmarks/app/perlfunc.pod view on Meta::CPAN
In scalar context, you get the name, unless the function was a
lookup by name, in which case you get the other thing, whatever it is.
(If the entry doesn't exist you get the undefined value.) For example:
$uid = getpwnam($name);
$name = getpwuid($num);
$name = getpwent();
$gid = getgrnam($name);
$name = getgrgid($num);
$name = getgrent();
#etc.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/perlfaq3.pod view on Meta::CPAN
# make file a month younger than today, defeating reaper daemons
perl -e '$X=24*60*60; utime(time(),time() + 30 * $X,@ARGV)' *
# find first unused uid
perl -le '$i++ while getpwuid($i); print $i'
# display reasonable manpath
echo $PATH | perl -nl -072 -e '
s![^/+]*$!man!&&-d&&!$s{$_}++&&push@m,$_;END{print"@m"}'
view all matches for this distribution
view release on metacpan or search on metacpan
lib/perlrc.pm view on Meta::CPAN
sub _home {
my $user = shift;
my $uid = (length $user ? getpwnam($user) : $>);
defined $uid or return "~$user";
my $home = (getpwuid $uid)[7];
defined $home or return "~$user";
$home
}
sub import {
view all matches for this distribution
view release on metacpan or search on metacpan
}
# Use system mailbox if none was specified on the command line
if ( $#ARGV < 0 ) {
if ( ! ($user = getlogin)) {
@a = getpwuid($<);
$user = $a[0];
}
if ( -r "/var/spool/mail/$user" ) { # Modern systems
@ARGV = ("/var/spool/mail/$user");
}
view all matches for this distribution