Hi,
afer trying a lot of stuff i figured out that following code line works:
my ($login,$pass,$uid,$gid) = (getpwnam($user),rand);
without rand it's still the old user... can anyone explain why perl seems to
cache this? (even without eval)
Tom Phoenix schrieb:
> On 5/18/07, Martin Barth <[EMAIL PROTECTED]> wrote:
>
> I suspect that your perl has cached the result of compiling that
> string, which is to say it's cached the old uid. If you need an eval
> string to be repeatedly re-compiled at runtime (and you fail to notice
> that this is a sign that your algorithm needs fixing) simply ensure
> that it's a different string each time you eval it. Perhaps something
> like this:
>
> my $serial;
> my $evil_result = eval("getpwnam('christian')" . "\n#" . ++$serial);
>
> But this is no endorsement of the evil eval. You've found merely one
> of its evil pitfalls. Avoid, avoid, avoid.
>
> Cheers!
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/