]> git.vpit.fr Git - perl/modules/subs-auto.git/blobdiff - lib/subs/auto.pm
We don't really need to localize the guard since there's no way it could recurse
[perl/modules/subs-auto.git] / lib / subs / auto.pm
index 87fcc5528712605318d73b56163c74e510f04e1c..9046588b62a090a32b9bf137cc8c045e63cb7d88 100644 (file)
@@ -121,9 +121,9 @@ sub _fetch {
  (undef, my $data, my $func) = @_;
  return if $data->{guard};
  return unless $func !~ /::/ and not exists $core{$func};
local $data->{guard} = 1;
+ $data->{guard} = 1;
  my $hints = (caller 0)[10];
- if ($hints and $hints->{bareword}) {
+ if ($hints and $hints->{subs__auto}) {
   my $mod = $func . '.pm';
   if (not exists $INC{$mod}) {
    my $fqn = $data->{pkg} . '::' . $func;
@@ -141,14 +141,16 @@ sub _fetch {
  } else {
   _reset($data->{pkg}, $func);
  }
+ $data->{guard} = 0;
  return;
 }
 
 sub _store {
  (undef, my $data, my $func) = @_;
  return if $data->{guard};
local $data->{guard} = 1;
+ $data->{guard} = 1;
  _reset($data->{pkg}, $func);
+ $data->{guard} = 0;
  return;
 }
 
@@ -175,14 +177,14 @@ sub import {
  my %args = @_;
  my $cur  = (caller 1)[0];
  my $in   = _validate_pkg $args{in}, $cur;
- $^H{bareword} = 1;
+ $^H{subs__auto} = 1;
  ++$pkgs{$in};
  no strict 'refs';
  cast %{$in . '::'}, $wiz, $in;
 }
 
 sub unimport {
- $^H{bareword} = 0;
+ $^H{subs__auto} = 0;
 }
 
 {