#! /usr/bin/perl; use strict; use warnings; package Foo; sub new { bless {}, shift }; sub foo { my $self = shift; @_ ? $self->{foo} = shift : $self->{foo}; }; sub show { print "foo is ", shift->foo, "\n" }; package Bar; sub new { bless {}, shift }; sub bar { my $self = shift; @_ ? $self->{bar} = shift : $self->{bar}; }; sub show { print "bar is ", shift->bar, "\n" }; package main; use constant Bar => 'Foo'; use constant Foo => 'Bar'; { package UNIVERSAL; no warnings; *kwenve = sub { my $self = shift; $self->new(@_) }; *kwjehd = sub { my $self = shift; $self->foo(@_) }; *kjwehd = sub { my $self = shift; $self->bar(@_) }; *kfdlfe = sub { my $self = shift; $self->new(@_) }; *kedfgf = sub { my $self = shift; $self->show(@_) }; }; my ($kivbe, $kfovg) = (Bar->kwenve, Foo->kfdlfe); # my ($foo, $bar) = (Foo->new, Bar->new); $kivbe->kwjehd(12); # $foo->foo(12); $kfovg->kjwehd(42); # $bar->bar(42); $kivbe->kedfgf; # $foo->show; $kfovg->kedfgf; # $bar->show;