# this makes a little sense package PUTTY; use CGI; sub new { return bless {}, shift; } sub loaded_plugins { qw( get_A get_B ) }; # when use PUTTY; is done, $a and $b get instantiated # and can be shared among all instances of PUTTY via $self->get_A # or simply PUTTY->get_A { my $a = new CGI; sub get_A { return $a; } my $b = new CGI; sub get_B { return $b; } } 1; package main; my $self = new PUTTY(); my $other = new PUTTY(); for my $plugin ( $self->loaded_plugins() ) { print $self->$plugin,"\n", PUTTY->$plugin,"\n", $other->$plugin,"\n\n"; }