News for hackers. Stuff that matters.
Re:Higher-Order Perl is available for free as a PDF by elblanco on Monday July 12, 2010 @02:00PM (#1508766)
The regex as a value generator in this book is really quite good. I've been dying to see somebody write it up and stick it on CPAN.
Re:Higher-Order Perl is available for free as a PDF by mst on Monday July 12, 2010 @04:02PM (#1509205)
Well, go for it then - that'd be awesome! If you tweet @shadowcat_mst when you're ready I'll make sure your PAUSE account gets approved quickly (you're also welcome to bug me about how to build dists etc., I'm always happy to walk people through their first upload).

Note that if you already have an account and uploads, I apologise for not recognising who you are but you're still welcome to bug me if there's anything I can do to help :)

Re:Higher-Order Perl is available for free as a PDF by elblanco on Monday July 12, 2010 @05:14PM (#1509457)
Appreciate the offer. Unfortunately it's item 100 on a to-do list of 100 atm.
Re:Higher-Order Perl is available for free as a PDF by JadeNB on Monday July 12, 2010 @05:49PM (#1509561)
It's been a while since I read the book, and I don't remember this use of regexes; but is it by chance covered under Ovid's HOP::Parser module (http://search.cpan.org/~ovid/HOP-Parser), or another in that family (http://search.cpan.org/search?query=HOP)?
Re:Higher-Order Perl is available for free as a PDF by elblanco on Monday July 12, 2010 @10:50PM (#1510198)
I've been looking for such a beast in the wild for quite some time. I've seen a few on CPAN that'll take a regex (or some type of expression, or some limited dialect of regex) and spit out a few random strings. Even Microsoft's REX tool (http://research.microsoft.com/en-us/projects/rex/), which is the best I've seen, gives nondeterministic random results.

Having a tool that would take a PCRE (or some subset of the language), apply some constraints on repetition operators (like *->{0,2}, +->{1,2}) etc., spit out a deterministic list of values (don't care how long so long as it's reasonably finite) would be extremely powerful for software testing. Even the rather limited capabilities in REX have helped me fix some invalid assumptions I was making about valid inputs.

It's always seemed strange to me that regular expressions are described in the literature as string generators, yet I've pretty much only ever seen them used as string acceptors in practice in the form of a predicate (s in set <REGEX>?).

Re:Higher-Order Perl is available for free as a PDF by mjd on Monday July 12, 2010 @08:00PM (#1509884)
It's section 6.5, "Regex string generation". Page 272: "Given a regex, how can one generate a list of all the strings matched by the regex?"