Class-Loader reviews

RSS | Module Info

Class-Loader (2.02) *

Bad code. It's point is to delay the loading phase of a module
(or making it conditional), and to return an object, created by
the module's constructor. This can be written as

sub load {

my ($module, $constructor, @args) = @_;

eval "require $module";

return $@ ? undef : $module->$constructor(@args);

Class::Loader, however, complicates this simple issue by using
Data::Dumper to serialize constructor's arguments (which causes
problems, if the arguments are more complicated objects; for
example: Math::Pari).

The output of Data::Dumper is processed in as careless way as

s/\$VAR1 = \[//;


This module provides no diagnostics and doesn't perform any
checks on its input (for example, if the arguments for the
constructor are really passed as an array reference as expected),
therefore I rate "ease of use" as 2.