MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

callers() intensity



So I am looking at the following verb, which I haven't yet put on
LambdaMOO's $perm_utils.  (It's written for 1.7.9p2, with obvious
leanings towards 1.8.0p5 once available.)

>":standard_permission_check( [BE GENTLE WITH ME] )";
>"Usage:";
>"  $<something>:standard_permission_check()";
>"    or";
>"  if (!$<something>:standard_permission_check(1))";
>"    return E_PERM;";
>"  endif";
>"... this function may be used to REPLACE the commonly-used permissions check";
>"  if (caller == this || $perm_utils:controls(caller_perms(), this)";
>"    return E_PERM;";
>"  endif;";
>"if BE GENTLE WITH ME is provided and true,then E_PERM will be -returned- if
>the permission check fails, otherwise E_PERM is -raised-.";
>gentle = args ? args[1] | 0;
>"WARNING: awful horrible variable-name abuse is about to follow";
>this = caller;
>callers = callers();
>caller = callers[2][1];
>caller_perms = callers[2][3];
>if (caller == this || $perm_utils:controls(caller_perms, this))
>  return 1;
>elseif (gentle)
>  return E_PERM;
>else
>  $error:raise(E_PERM);
>endif

There's tick wastage 'cause of the comments at the top, but I can fix that
by putting the documentation somewhere else and by tightening some code.
What I wonder about is how CPU-intensive a call to callers() is.  Is a
routine like this hard on the server?  I'd heard in past that callers() is
ucky, so before I install this and encourage its use (in a slightly
different form) I'd like to know if I'm doing a Bad Thing.

Seth / Blackbriar
----------------------------------------------------------------------
Seth I. Rich - sir@po.cwru.edu
                                 There is nothing more precious than
Rabbits on walls, no problem.    a tear of true repentance.



Home | Subject Index | Thread Index