I am working on a Perl script where it checks for root access, at the beginning of execution.
if ($< != 0) {
print "You need to be root";
die " ";
}
How is the $<
evaluated in Windows? I searched google and here, but could not find an answer.
The closest I got was in perlvar. It has some descriptions of special variable handling in Windows, but not for this case.
$<
The real uid of this process. (Mnemonic: it's the uid you came from, if you're running setuid.) You can change both the real uid and the effective uid at the same time by using POSIX::setuid(). Since changes to $< require a system call, check $! after a change attempt to detect any possible errors.