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:
Tels
Date:
March 20, 2007 15:03
Subject:
Re: [PATCH] Alter the package qr// gets blessed into via a pragma
Message ID:
200703202304.47047@bloodgate.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Moin,

On Tuesday 20 March 2007 20:11:14 Ævar Arnfjörð Bjarmason wrote:
> All regular expressions constructed with qr// are currently blessed
> into the "Regexp" package. This can be altered on a per-regexp basis
> by doing:
>
> my $re = bless qr/Ponies/ => "My::Regexp";
>
> But there's no way to alter the default.
>
> The attached patch allows for specifying what package regular
> expressions are blessed into by setting a package name in $^H{regobj},
> this would allow for writing extensions like the attached
> re::object::Test (which does nothing at the moment except retrieve the
> regexp struct from the object).

I really don't like the addition of new globals, 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?
	  {
	  }

I think this should still work, but I am not sure:

	if ($qr->isa('Regexp'))
	  {
	  }

or?

all the best,

tels

- -- 
 Signed on Tue Mar 20 23:02:59 2007 with key 0x93B84C15.
 Get one of my photo posters: http://bloodgate.com/posters
 PGP key on http://bloodgate.com/tels.asc or per email.

 "Die deutsche Zensoren  - - - - - - - - - - - - - - - - - - - - - - - -
 - - - - - - - - - - - - - - - - - - - - - - - - - - - Dummköpfe - - - -
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 - - - - - - - - - - - - - - -." Heinrich Heine

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iQEVAwUBRgBojncLPEOTuEwVAQIdvAf/TmzHFtPuimrJU7hCM2lxNI8x+gdYx4Qh
5eGwpFlLu5BN0+R1me0v2lgjKHEyljzZUVC+zcZjoYutvwff0kZdzqaDj9Ws5SYB
ke/vg66+spK0NgA3hk939UT3X1ngKORQ3J/lOjhA0HXtxQeJib/8I280HQqiEuc6
lZ6vNEsnpJkk0SnIFrfpoc3Dfi6Dv6y1gMst2yhQmkliYsblU/YGt5pwiaPVh1RG
Pv06T+wP/dfKW+gRpNwgIqt2irEhzIEcxDMnt3JDAuw8jLb3wIcj73yIZsskEL4+
qnBEshc7xrzUA7cdmGXtpxsPuHyWdGL0twPquCYrdtXKO4fwqtglBw==
=K6S4
-----END PGP SIGNATURE-----

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