Agreed, maybe i was'nt precise enough i my statement:
I do not find the fact that i include a "use" declaration for new functionality suprising, this is i what i normally expect and want.
Also i maybe did'nt provide enough information about the
the context of the "application" i was writing: a "little" monitoring daemon. The function,which instanciates the objects, does this by reading from file and instanciates them by parsing the input from the file, something like the following:
sub load {
my ($self, $filename) = @_;
open (LOGGERS, "< " . $filename);
my ($line);
while ($line = <LOGGERS>) {
chomp $line;
if (!$line) { last;}
my @parms = split /:/, $line;
my $loggertyp = shift @parms;
my $logger = ${loggertyp}->new();
$logger->systemname($self->systemname);
$logger->subject($self->subject);
while (@parms) {
my $parmtyp = shift @parms;
my $parmvalue = shift @parms;
${logger}->${parmtyp}($parmvalue);
}
$self->loggers($logger);
}
close(LOGGERS);
}
It actually knows nothing about "functionality" it makes available.
In this context it would be a great thing, if i just could write a new perl module, change the file and the tell the daemon through some signal, to newly load the file and the "daemon" executes new functionality,granteed the whole thing is well tested etc. With the "use" declarations, i additionally have to stop the "daemon" and change the source code of this module. So that's the reason, that in this context, i would prefer not be be explicit.
Chris