ton has asked for the wisdom of the Perl Monks concerning the following question:
I recently read through Jeffery Goff's excellent Parse::RecDescent tutorial. This inspired me to write my own context free grammar to parse the results of Data::Dumper, as eval-ing the structure is a huge security hole.
I've got everything working except for escaped character interpolation on double-quoted strings (e.g. "\t", "\n"). In other words, I want to be able to convert the string '\t' into ASCII 9. Is there an easy way to do this other than writing regexs for every escape I want to catch? Please note that I do not want to use eval, as this would just reintroduce the security hole. I also do not want to do any kind of variable expansion.
Thanks!
-Ton
BTW: I realize that Data::Dumper dumps its strings in single quote mode. The interpolation is solely for completeness. :)
-----
Be bloody, bold, and resolute; laugh to scorn
The power of man...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Selective string interpolation
by japhy (Canon) on Jun 29, 2001 at 03:48 UTC | |
|
Re: Selective string interpolation
by tadman (Prior) on Jun 29, 2001 at 03:46 UTC | |
|
Re: Selective string interpolation
by ton (Friar) on Jun 29, 2001 at 05:02 UTC | |
by merlyn (Sage) on Jun 29, 2001 at 08:59 UTC |