]> git.vpit.fr Git - perl/modules/subs-auto.git/blobdiff - lib/subs/auto.pm
Use the op_info feature to prevent hooking of method calls
[perl/modules/subs-auto.git] / lib / subs / auto.pm
index 9ec068731be7f8660edc98329e626809bc03baed..928ea7e51bf8401b9f4648e9629d7ed27c88eac5 100644 (file)
@@ -63,7 +63,7 @@ use B;
 
 use B::Keywords;
 
-use Variable::Magic qw/wizard cast dispell getdata/;
+use Variable::Magic 0.31 qw/wizard cast dispell getdata/;
 
 BEGIN {
  unless (Variable::Magic::VMG_UVAR) {
@@ -108,9 +108,15 @@ sub _reset {
 sub _fetch {
  (undef, my $data, my $func) = @_;
 
- return if $data->{guard} or $func =~ /::/ or exists $core{$func};
+ return if $data->{guard};
  local $data->{guard} = 1;
 
+ return if $func =~ /::/
+        or exists $core{$func};
+
+ my $op_name = $_[-1] || '';
+ return if $op_name =~ /method/;
+
  my $pkg = $data->{pkg};
 
  my $hints = (caller 0)[10];
@@ -155,9 +161,10 @@ sub _store {
  return;
 }
 
-my $wiz = wizard data  => sub { +{ pkg => $_[1], guard => 0 } },
-                 fetch => \&_fetch,
-                 store => \&_store;
+my $wiz = wizard data    => sub { +{ pkg => $_[1], guard => 0 } },
+                 fetch   => \&_fetch,
+                 store   => \&_store,
+                 op_info => Variable::Magic::VMG_OP_INFO_NAME;
 
 my %pkgs;