http://qs321.pair.com?node_id=161908


in reply to Re: Identifying if a variable is the product of a qr//
in thread Identifying if a variable is the product of a qr//

As soon as you bless it into another package, it is no longer a precompiled regex,but a reference to an undefined scalar (Dumper isn't handling this incorrectly, the scalar actually is undef).

Er, no (although thats what I thought at first too, run the code I provided.) It still is a precompiled regex otherwise it wouldn't match as it did in my example code.

This is normal behaviour. If $object is blessed into Foo, and you re-bless it into Bar, it is no longer an object of class Foo.

The results that I got in the code I posted suggest that in fact a regex is a base type like array or hash and thus its underlying behaviour does not change as it is blessed and reblessed.

Oh and it gets weirder, there is no way using UNIVERSAL::isa() to determine if a blessed scalar ref is a regex.

Yves / DeMerphq
---
Writing a good benchmark isnt as easy as it might look.