Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: Re: Identifying if a variable is the product of a qr//by demerphq (Chancellor) |
on Apr 25, 2002 at 10:21 UTC ( [id://161908]=note: print w/replies, xml ) | Need Help?? |
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
In Section
Seekers of Perl Wisdom
|
|