package MyObjs;
use strict;
use warnings;
use enum qw[ :MOError=0 One Two Three Four Five ];
sub import {
my $self = shift;
my $caller = caller();
for( @_ ) {
if( /^:MO/ ) {
no strict; no warnings;
*{ "$caller\:\:MOError$_" } = *{ "MOError$_" } for qw[ One Two Three Four Five ];
}
elsif( /^:O1/ ) {
no strict; no warnings;
*{ "$caller\:\:O1Error$_" } = *{ "Object1\:\:O1Error$_" } for qw[ One Two Three Four Five ];
}
elsif( /^:O2/ ) {
no strict; no warnings;
*{ "$caller\:\:O2Error$_" } = *{ "Object2\:\:O2Error$_" } for qw[ One Two Three Four Five ];
}
else {
die "Unknown export $_";
}
}
}
package Object1;
use enum qw[ :O1Error=100 One Two Three Four Five ];
package Object2;
use enum qw[ :O2Error=200 One Two Three Four Five ];
1;