in reply to Which comes first . . .

All calls to "use" are done at compile time, so in your case you need "require" (and "import") to do it at runtime. Instead of "use lib", you'll need to push @INC, $lib;.

To summarize:

my $lib = $self->config_param('library'); push @INC, $lib; # uncomment the calls to import if needed require Registration::WWW::htmlgui; # import Registration::WWW::html +gui; require Registration::DB; # import Registration::DB;