From: Roland G. <RGi...@cp...> - 2002-08-04 10:01:10
|
Quoting "Blackstone, J. David" <jda...@ci...>: > Another thing I meant to say about regexes is I think it would be > really cool if we could drop -re altogether. To my mind it seems like the > method should use ref to see if you've passed a qr// regex or a plain > scalar. Of course, my mind doesn't work like anyone else's, and it would break > backward compatibility. Right, and that's why it's not gonna happen. Please note that with the new syntax with callbacks it's already the default: $exp->expect($timeout, [ "regexp", \&callback ], [ qr/regexp/, \&callback ],); And this is the much more powerful syntax, so I personally consider the old syntax (where you have to test which regexp index has matched) somewhat obsolete and only a beginners drug to get them hooked until they realize the full power of callbacks... :-) > However, this seems to be more in keeping with Perl 6's newfound "A > regex is not really a string" philosophy. qr// was a great piece of > syntax, and I'd like to see it be a more first-class member of the language with > some modules. Hmm, I offhand don't know a means to find out if a given scalar already contains a precompiled regexp. If such a check is available I'd surely implement it to make expect() even more DWIMmish in that regard, making sure that a precompiled regexp wouldn't be handled with a substr match... Anybody got an idea? Roland -- RGi...@cp... |