On 10.05.2013 08:01, damian@conway.org via RT wrote:
Show quoted text> <URL:
https://rt.cpan.org/Ticket/Display.html?id=85159 >
>
>> I have a question, i cant hardcode rules directly at code, so i need to
>> add some rules from variables via interpolation. How can i do it in
>> legit way? I didn't find a good solution, but only a hack...
> I usually do it as in the code below.
> It seems to work fine.
>
> Damian
yes, your example works fine, but if you put all query in scalar and
write qr{$rules}xims;, for example, that doesn't work, and in this
situation one doesn't know whats wrong -- rules or constructor :)
http://pastebin.com/0K7C0iLz
And example of massive regexps(one regexp for one rule) that doesn't work.
In $grammar->{W} dump you can see that it searches for ^ K $, but this
is wrong.
http://pastebin.com/XuA02uPf
This is simplified example of my abnf-validator.
--cut--cut--cut--cut--cut--cut--cut--cut--cut--cut--cut--cut--cut--cut--cut--cut--cut--cut--cut--cut--
Script output
A win
B win
C win
D win
E win
F win
G win
H win
I win
J win
K win
L win
M fail
N fail
O fail
P fail
Q fail
R fail
S fail
T fail
U fail
V fail
W fail
X fail
Y fail
Z fail
--
Kindest Regards,
Arseny Krasikov