#!/usr/bin/perl use strict; use warnings; use Dinnerclosure; my $dirtyeater = Dinnerclosure->new(); { no strict 'refs'; no warnings 'redefine'; local *{"Dinnerclosure::washhands"} = sub { my $obj = shift; $obj->{'handsclean'} = 1; print "I didn't really wash my hands\n"; return 1; }; $dirtyeater->{'washhands'}->(); $dirtyeater->{'eatfood'}->(); } __END__ I didn't really wash my hands You washed your hands -eat all you want