But, unfortunately it doesnt address the question im trying to solve. My question is this: given an arbitrary blessed scalar ref, how does one efficiently determine if the object is in fact a regex? Your solution, which i personally think is rather ingenious, solves "How do I make a blessed ref, when stringified, return the pattern?". Which is I think useful indeed, but unfortunately not what I need. (I recognize I may not have specified the requirement sufficiently.)
Even though this is a solution from the point of view of designing a class, it has the problem that its underlying concept, that of qr//ing the value, doesn't generalize. How do you detect a failure? There would be no way to determine if the wrapped object actually had produced regex, or just a ref stringified, or any number of other magic events.
Anyway, ++ for the idea...
--- demerphq
my friends call me, usually because I'm late....
In reply to Re: Re: Code critique XS function for extracting a blessed regex's pattern.
by demerphq
in thread Code critique XS function for extracting a blessed regex's pattern.
by demerphq
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |