diff options
author | Yves Orton <demerphq@gmail.com> | 2007-03-08 11:20:50 +0100 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-03-08 15:48:53 +0000 |
commit | 67261566773bc3c68100784bb02fb0dc880102ec (patch) | |
tree | f36eaf725f9ade66a50e2891b2373ef006f99ae7 /lib/Tie | |
parent | 803059618a6e90fb614193e8cdf81c79f27d8764 (diff) | |
download | perl-67261566773bc3c68100784bb02fb0dc880102ec.tar.gz |
Re: [PATCH] Tweaks so that miniperl.exe doesnt croak while building perl.exe
Message-ID: <9b18b3110703080120s41147a4fh4f4c1f9817079be3@mail.gmail.com>
p4raw-id: //depot/perl@30518
Diffstat (limited to 'lib/Tie')
-rw-r--r-- | lib/Tie/Hash/NamedCapture.pm | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/Tie/Hash/NamedCapture.pm b/lib/Tie/Hash/NamedCapture.pm index 950adca2f6..3383f166d8 100644 --- a/lib/Tie/Hash/NamedCapture.pm +++ b/lib/Tie/Hash/NamedCapture.pm @@ -3,17 +3,23 @@ package Tie::Hash::NamedCapture; use strict; use warnings; -our $VERSION = "0.03"; +our $VERSION = "0.04"; sub TIEHASH { my $classname = shift; - my $hash = {@_}; + my %opts = @_; - if ($hash->{re} && !re::is_regexp($hash->{re})) { - die "'re' parameter to ",__PACKAGE__,"->TIEHASH must be a qr//" + if ($opts{re} && !re::is_regexp($opts{re})) { + require Carp; + Carp::croak("'re' parameter to " . __PACKAGE__ + . "->TIEHASH must be a qr//."); } - return bless $hash, $classname; + my $self = bless { + all => $opts{all}, + re => $opts{re}, + }, $classname; + return $self; } sub FETCH { @@ -52,6 +58,9 @@ sub SCALAR { return scalar re::regnames($_[0]->{re},$_[0]->{all}); } +tie %+, __PACKAGE__; +tie %-, __PACKAGE__, all => 1; + 1; __END__ |