Closed nowinter closed 9 years ago
The critical line in run_regexp_set_on_value
(in Value.pm
) is this one:
my $sub = sub { $test_sub->( $_[0], $rxp ) };
The trick is: $test_sub
is not run here, but stored in another anonymous sub ($sub
). In this anonymous sub, $rxp
is a closure, and $_[0]
is the first parameter passed to $sub
when it is called. (outside of this sub definition, $_[0]
is indeed $self
, i.e. the Value object).
The call to $sub
is done in run_code_on_value
in the following line:
my $ret = $sub->($$value_r);
Thus $_[0]
is indeed set to $$value_r
as you suggested
Does this answer your concern ?
Ooops, sorry, you are right! This is not an issue
no problem. I'm glad to find out that some people are reading my code :-)
the run_regexp_set_onvalue sub callback is set to compare $[0] to $rxp I think it should be $$value (which is the value) instead of $_[0] (which is the Value object)