package Test::Stash; use base qw(Template::Stash); use strict; use warnings; use Scalar::Util qw( blessed reftype ); use Template::Config; our @PATH; our $BYPASS = 0; sub _dotop { my ($self, $root, $item, $args, $lvalue) = @_; unless ($BYPASS) { my $rootref = ref $root; my $atroot = (blessed $root && $root->isa(ref $self)); if ($atroot) { @PATH = $item; } else { push @PATH, $item; } if (blessed $root && $root->can($item)) { # likely a method call if ($root =~ m{ \A( DBIx::Class::QueryLog(::(Query|Analyzer))? | # (redacted Catalyst model class) | Template::Plugin::(Math|Date) | Moose::Meta::Class:: .*? )=}x) { ## ignore these } else { local $BYPASS = 1; my $component = $self->get(['component', 0, 'name', 0]); warn sprintf "%s: %s => %s\n", $component, join('.', @PATH), $root; } } } return (shift @_)->SUPER::_dotop(@_); } # warn "Loaded Test::Stash... before is $Template::Config::STASH"; $Template::Config::STASH = __PACKAGE__; # warn "Loaded Test::Stash... after is $Template::Config::STASH"; 1;