my $window= $mech->repl->expr('window'); $window->{alert}= sub {}; ...