If you simply want to terminate with an exception, why not wrap the calls to Class::MixinFactory with an eval block. Maybe something like this (psuedocode)?
sub makeMixin { #input is an array of file names my @aImpliedPackageNames = map { ... } @_; my $class; eval { $class = MyClass->class(@aImpliedPackageNames); return 1; } or do { my $e=$@; # compute exception of your choosing, e.g. # a list of missing modules: my @aNotFound; foreach my $sPackage (@aImpliedPackageNames) { if (!eval("scalar keys %${sPackage}::")) { push @aNotFound, $sPackage; } } if (scalar(@aNotFound)) { die "Couldn't make mixin: the following packages " . "are undefined: @aNotFound"; } else { die $e; } } return $class; }
Best, beth
In reply to Re: Finding out whether a module contains a certain package
by ELISHEVA
in thread Finding out whether a module contains a certain package
by rovf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |