I donβt believe that there is anything to be done in the debugger, but I turned my own attached scalar class and set a breakpoint in the routine "ScalarSnoop :: STORE".
Here's the class:
package ScalarSnoop; use strict; use base qw(Tie::Scalar); sub TIESCALAR { my $class = shift; my $value = shift; return bless \$value, $class; } sub FETCH { my $self = shift; return $$self; } sub STORE { my $self = shift; my $newvalue = shift; $$self = $newvalue; } 1;
And here is the script that uses it:
#!/usr/bin/env perl use v5.14.0; use strict; use warnings; use lib qw(.); use ScalarSnoop; my ($first, $second, $third); tie $second, 'ScalarSnoop'; $first = 'hey'; $second = 'there'; $third = 'dude';
Launch the debugger and set a breakpoint using b postpone ScalarSnoop::STORE . Keep working and the debugger will stop when someone stores the value in your scalar. Then you can reset the stack trace and see who it was.
source share