#!/usr/bin/perl -w use strict; package destination; package main; use Test::More 'no_plan'; { no strict 'refs'; *{'destination::foo'} = sub { 'foo' }; } is( destination::foo(), 'foo', 'install a sub' ); { no strict 'refs'; my $d = *{ 'main::destination::' }; delete $d->{foo}; } ok( ! destination->can( 'foo' ), '... now remove it' );