{ package Foo; # Foo stuff # goes in here. } sub FooFunc { # This function is Foo::FooFunc! #actually it's not! It is in main. I was wrong. } package main; sub MainFunc { # This function is main::MainFunc. } #### package Foo; { # Foo stuff # goes in here. } package main; # back in main. #### #!/usr/bin/perl use strict; use warnings; package Foo; sub method { routine(); } sub routine { return __PACKAGE__; } package Foo::Bar; our @ISA = qw( Foo ); sub routine { return __PACKAGE__; } sub method { no warnings 'redefine'; # Temporarily override routine() in the parent class. local *Foo::routine = \&routine; # Delegate to parent method. my $self = shift; $self->SUPER::method(@_); } package main; print "Foo: ", Foo->method, "\n"; print "Foo::Bar: ", Foo::Bar->method, "\n"; print "Foo: ", Foo->method, "\n";