use Carp;
use Data::Dumper;
use List::Util qw(first);
-use SL::DB::CustomVariableConfig;
use constant META_CVARS => 'cvars_config';
sub _all_configs {
my (%params) = @_;
+
+ require SL::DB::CustomVariableConfig;
+
$params{module}
? SL::DB::Manager::CustomVariableConfig->get_all(query => [ module => $params{module} ])
: SL::DB::Manager::CustomVariableConfig->get_all;
my ($module, %params) = @_;
keys %{ $params{overloads} }; # reset each iterator
- while (my ($fk, $class) = each %{ $params{overloads} }) {
- return ($fk, $class) if $class->meta->{META_CVARS()}->{module} eq $module;
+ while (my ($fk, $def) = each %{ $params{overloads} }) {
+ return ($fk, $def->{class}) if $def->{module} eq $module;
}
croak "unknown overload, cannot resolve module $module";
my (%params) = @_;
my %modules;
- while (my ($fk, $class) = each %{ $params{overloads} }) {
- eval "require $class"; # make sure the class is loaded
- my $module = $class->meta->{META_CVARS()}->{module};
- next if ref $module;
- $modules{$module} = 1;
+ for my $def (values %{ $params{overloads} || {} }) {
+ $modules{$def->{module}} = 1;
}
return [ keys %modules ];
sub_module => 'orderitems',
cvars_alias => 1,
overloads => {
- parts_id => 'SL::DB::Part',
+ parts_id => {
+ class => 'SL::DB::Part',
+ module => 'IC',
+ }
}
);