Subject: | Deal with blessed regexes |
Regex objects (like qr/Foo/) are kind of special in Perl
because they have a REGEXP reftype but are blessed into "Regexp"
package. That means it is not desirable to dump qr/Foo/ into
bless(qr/Foo/, "Regexp")
which is redudant, but if the blessed package is other than "Regexp"
it is necessary to resort to the "bless" expression, as in
bless(qr/Foo/, "Regexp::Alt")
Currently, this is the output by Data::Dump for such cases:
perl -MData::Dump=pp -e 'pp(bless qr/Foo/, "Regexp::Alt")'
do {
my $a = bless(do{\(my $o = do{my $fix})}, "Regexp::Alt");
$$a = $a;
$a;
}
With the changes in this pull request https://github.com/gisle/data-dump/pull/15, the output becomes
perl -MData::Dump=pp -e 'pp(bless qr/Foo/, "Regexp::Alt")'
bless(qr/Foo/, "Regexp::Alt")
which evaluates correctly and follows what Data::Dumper
and Data::Dump::Streamer do.