the the instance i think i go for something like this (its not too pretty but works):
sub rootMeAndDoStuff(){
my $rootID = getpwnam("root");
if (not ($rootID eq $<)){
print "U have to be root to do the following ...\n";
system "su -c $PartToDoAsRoot";
}
}
but i am not very content with it since this wont work under win32. and sooner or later it has to.
update: there is in fact a way to do exactly the same under win32:
sub adminMe(){
my $adminID = 0;
if (not ($adminID eq $<)){
print "U have to be an Administator to do this ...\n";
print "Give me a name of a local Administator:\n";
my $admin = <STDIN>;
chomp $admin;
my $hostname = hostname;
system "runas /user:$hostname\\$admin
\"cmd /K perl $whatToDoAsAdmin\"";
}
}
----
NaSe
:x |