develooper Front page | perl.perl5.porters | Postings from March 2007

Re: [PATCH] Alter the package qr// gets blessed into via a pragma

Thread Previous | Thread Next
From:
Ævar Arnfjörð Bjarmason
Date:
March 20, 2007 15:12
Subject:
Re: [PATCH] Alter the package qr// gets blessed into via a pragma
Message ID:
51dd1af80703201511v604ee97ch726cd86554021572@mail.gmail.com
> I really don't like the addition of new globals

Yeah, I don't like it either:)

> wouldn't that really screw over code that does something like this:
>
>         my $qr = $qr;
>
>         if (ref($qr) eq 'Regexp'))      # you probably shouldnt do this anyway?
>           {
>           }

If you were to import a lexical pragma that changes the defalt package
for qr// constructs into a scope that expects them to be in the Regexp
package then yes, it would screw with that code.

> I think this should still work, but I am not sure:
>
>         if ($qr->isa('Regexp'))
>           {
>           }
>

Yes, ->isa works since the qr// object is blessed with sv_bless()

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About