Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

getting the real and effective UIDs of current process

by greatnorthern (Initiate)
on Apr 10, 2000 at 15:39 UTC ( [id://7228]=perlquestion: print w/replies, xml ) Need Help??

greatnorthern has asked for the wisdom of the Perl Monks concerning the following question:

How do I do this. Had a glance at perldoc perlvar which advised me to use $< and $>. Unfortunately, I'm not somewhere I can go back and check the docs. Do I need to 'use english' in order to use $UID and $EUID or am I miles off the mark here?
  • Comment on getting the real and effective UIDs of current process

Replies are listed 'Best First'.
Re: getting the real and effective UIDs of current process
by snowcrash (Friar) on Apr 10, 2000 at 16:25 UTC
    Yep, $< and $> work fine. In order to use the long variable names ($UID or $REAL_USER_ID and $EUID or $EFFECTIVE_USER_ID) you have to use English; Note that "English" is capitalized.
Re: getting the real and effective UIDs of current process
by mikfire (Deacon) on Apr 10, 2000 at 16:21 UTC
    $< is your real, $> is your effective. The appropriate manpages in the Library for later reference.

    Mik
    Mik Firestone ( perlus bigotus maximus )

RE: getting the real and effective UIDs of current process
by little_mistress (Monk) on Apr 10, 2000 at 22:52 UTC
    The answer comes from the Perl in a Nutshell book, probably the bestest desk top book for perl, p.53.

    One of the really neatest things about perl in general is all of the nifty special variables. If you want longer easier to read variables try useing the English.pm modual. Though i would caution because it may be the case that you are working on a system that doesn't have it, and your in the ugly position of not being able to install it. That would suck.

    $real_uid = $<; $effective_uid = $>;
    little_mistress@mainhall.com

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://7228]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-24 19:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found