perl -we 'sub b { my $a; *b = \&c; b() } sub c { die "here" } b()' #### package NVC::DB::User; sub bless { my $self = shift; my $config = $self->config; # do this only once, on first call no warnings qw/ redefine /; if ($config->extend_user('type 1')) { *bless = \&bless_type1; } elsif ($config->extend_user('type 2')) { *bless = \*bless_type2; } else { *bless = \&bless_simple; } return $self->bless(@_); }