#!/usr/bin/perl use warnings; use strict; package TestBase; use base 'Exporter'; our @EXPORT_OK = qw(new do_this); sub new { warn "Calling Test1::new\n"; bless {}, shift; } sub do_this { my $self = shift; warn "doing_this to $self\n"; } package Test1; TestBase->import(qw(new do_this)); package Test2; TestBase->import(qw(new do_this)); package main; my $obj1 = Test1->new(); $obj1->do_this(); my $obj2 = Test2->new(); $obj2->do_this(); #### #!/usr/bin/perl use warnings; use strict; package TestBase; use base 'Exporter'; our @EXPORT_OK = qw(do_this); sub do_this { my $self = shift; warn "doing_this to $self\n"; } package Test1; TestBase->import(qw(do_this)); use base 'Exporter'; our @EXPORT_OK = (@TestBase::EXPORT_OK); package main; Test1->import(qw(do_this)); do_this("some string");