Guys, could need some quick input here.
Consider a hypothetical SA setting, that accepts s/// substitution
operator REs, and needs to perform $n variable substitution.
switch s/(foo)(bar)/is $2 and $1/
In order to process that, I need a Perl eval() in some form or another.
Which does have some security implications -- even though this is an
*admin* only setting, of course. Now, the question is:
Do we need to protect the admin from himself?
Do we have to assume, the admin might accidentally place a system call
in that string? Or would an explicit note, clear warning and maybe a
Security section in the POD be sufficient?
Any other ideas, how to perform variable substitution in strings? Keep
in mind the number of $n is not limited.
Any feedback greatly appreciated.
FWIW, I do have some kind of substitution code handy, that replaces a
short, easy to grok eval() one-liner for some hard to understand code
section, but generally does the trick. Slower.
--
char *t="\10pse\0r\0dtu...@ghno\x4e\xc8\x79\xf4\xab\x51\x8a\x10\xf4\xf4\xc4";
main(){ char h,m=h=*t++,*x=t+2*h,c,i,l=*x,s=0; for (i=0;i<l;i++){ i%8? c<<=1:
(c=*++x); c&128 && (s+=h); if (!(h>>=1)||!t[s+h]){ putchar(t[s]);h=m;s=0; }}}