diff options
author | Nicholas Clark <nick@ccl4.org> | 2006-04-21 20:38:15 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-04-21 20:38:15 +0000 |
commit | 380e0b81e09ad752fe245d3a881f3c6fd5d1f3a7 (patch) | |
tree | dd1bbdcf3766af89ebb3ce08781e5290d78e9acc /ext/re | |
parent | 385d56e4959776c85d4b164b2a72253a12f817be (diff) | |
download | perl-380e0b81e09ad752fe245d3a881f3c6fd5d1f3a7.tar.gz |
Refactor re.pm slightly. This has no change to documented behaviour,
but anyone mad enought to set ${^RE_DEBUG_FLAGS} and then do
no re 'Debug'; will now find that it will load the debuging version of
the regexp engine.
p4raw-id: //depot/perl@27934
Diffstat (limited to 'ext/re')
-rw-r--r-- | ext/re/re.pm | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/ext/re/re.pm b/ext/re/re.pm index 85ed9b6c6b..96b1d63cb7 100644 --- a/ext/re/re.pm +++ b/ext/re/re.pm @@ -1,6 +1,6 @@ package re; -our $VERSION = 0.06; +our $VERSION = 0.06_01; =head1 NAME @@ -136,6 +136,19 @@ my %flags = ( my $installed = 0; +sub _load_unload { + my $on = shift; + require XSLoader; + XSLoader::load('re'); + if ($on) { + install() unless $installed; + $installed=1; + } else { + uninstall() if $installed; + $installed=0; + } +} + sub bits { my $on = shift; my $bits = 0; @@ -148,8 +161,6 @@ sub bits { if ($s eq 'Debug' or $s eq 'Debugcolor') { setcolor() if $s eq 'Debugcolor'; ${^RE_DEBUG_FLAGS} = 0 unless defined ${^RE_DEBUG_FLAGS}; - require XSLoader; - XSLoader::load('re'); for my $idx ($idx+1..$#_) { if ($flags{$_[$idx]}) { if ($on) { @@ -163,25 +174,11 @@ sub bits { join(", ",sort { $flags{$a} <=> $flags{$b} } keys %flags ) ); } } - if ($on) { - install() unless $installed; - $installed = 1; - } elsif (!${^RE_DEBUG_FLAGS}) { - uninstall() if $installed; - $installed = 0; - } + _load_unload($on ? 1 : ${^RE_DEBUG_FLAGS}); last; } elsif ($s eq 'debug' or $s eq 'debugcolor') { setcolor() if $s eq 'debugcolor'; - require XSLoader; - XSLoader::load('re'); - if ($on) { - install() unless $installed; - $installed=1; - } else { - uninstall() if $installed; - $installed=0; - } + _load_unload($on); } elsif (exists $bitmask{$s}) { $bits |= $bitmask{$s}; } else { |