List Info

Thread: Correct replace vmethod




Correct replace vmethod
user name
2006-02-02 04:47:21
Sergey Martynoff wrote:
>> I have created a simple test, which compares
results of native
>> perl s/// (via eval) and proposed template
'replace' vmethod.
> 
> After thinking a bit, I understand that trying to
recreate perl
> s/// behavior in details is a bad idea. I think that
reasonable
> level of details is simulating perl's $1, $2 etc
backreferences,
> with possibility to escape $ with backslash, and to
escape
> backslash itself before $1 (etc). So I throw out 1, 2
tests from
> my vmeth_replace.t and added some other tests. You can
find it
> here: http://martynoff.info/tt2/


Yes, I was just about to fire off an email about how it
would be bad 
to support 1, 2, etc. If I remember correctly, the perl
docs 
themselves frown upon that usage, and it's basically only
there for 
backward compatibility.

Thanks for the test file. I might give it a shot tomorrow.

-- Josh

_______________________________________________
templates mailing list
templatestemplate-toolkit.org
http://lists.template-toolkit.org/mailman/listinfo/t
emplates
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )