#perl - Tue 1 May 2007 between 09:40 and 09:44



pyguyyalthough all those casts do remind me of C..
or BASIC
Yaakovf00li5h: You need to scrub any regex that you allow them to use.
f00li5hYaakov: just block eval it, and hope for the best
maukeI don't like "scrubbing"
f00li5hmauke: explains the smell
maukespecify an input format and write a parser for it
pyguyyyaukov: i'm not worried about dangerousness because only i'm using this script, but i would like it to be resilient. does eval(1) return 1? :|
Yaakovpyguyy: There is no casting in perl.
integralIt's too unreliable, and why should *you* do it?
pyguyyYaakov i know
4+"4"=8
or "8" if you prefer
it's actually pretty gorgeous
dazjorzeval: 4+"4"
maukeit's 8, actually :-)
buubotdazjorz: 8
f00li5hpyguyy: eval returns the same thing as a sub does
pyguyyyes it's 8 ._.
f00li5h, nice
f00li5hpyguyy: use block eval, not string eval, k?
dazjorzdoes buubot have a python eval?
Yaakovintegral: In some cases, when you want to provide user-defined regex(like) behavior you need to do something. My usual approach is a meta-grammar for permitted functionds.
functions
pyguyyif eval("$t =~ $x; 1") != 1 {
print "Bad regex, pal"
f00li5hYaakov: what can go wrong in accepting a regex?
pyguyyseems right
f00li5h, what's the difference?
Yaakovf00li5h: code execution
maukepyguyy: syntax error, string eval, EWW
integralYaakov: Well, if you didn't use perl, there'd be a proper parser library, which you would use
maukeYaakov: I'd like to see that
f00li5hYaakov: oh, with (?e ... )?
integral(the cult of the regexp)--
pyguyyoh... $x could contain other commands, yes
but again only i'll ever use it so i won't sploit myself
Yaakovf00li5h: yes.
pyguyywhat's a block eval?
maukeyou can get infinite runtime or a segmentation fault but I don't see an easy way to run code from a regex

Page: 4 11 18 25 32 39 46 53 60 67 74 81 88 95 102 

IrcArchive