If these are just classes (i.e. they donβt export any functions or variables when you use them), then all that really matters is that they were loaded.
Just create Component.pm :
package Component; our $VERSION = '1.00'; use Component::Root; use Component::Foo; use Component::Bar; use Component::Baz; use Component::Flib; use Component::Zen; use Component::Zen::Foo; use Component::Zen::Bar; use Component::Zen::Baz; ...
You don't need an Exporter or anything like that.
However, instead of having a module that is nothing but use statements, it probably makes sense to place these use statements in a node root class or in a module that creates a data structure, i.e. people will want to say:
use Component::Root; my $root = Component::Root->new(...);
or
use Component qw(build_structure); my $root = build_structure(...);
depending on how your data structure is usually created. For people, it can be a bit confusing:
use Component; my $root = Component::Root->new(...);
but it really depends on how your API looks. If there are several classes that people could call new on, then use Component might be the way to go.
source share