Nick,
> Can we see some code please?
Well, I didn't include any code because it doesn't seem to be
happening in the code on my side ... the argument looks fine well into
the depths of Class::MOP. But here's my version of load_class:
# load_class is a bit tougher, because we want to untaint whatever
is passed in
# note this is not a method, just a sub in our namespace
sub load_class
{
my ($classname) = @_;
my $modname = $classname;
$modname =~ s@::@/@g;
$modname .= '.pm';
foreach my $dir (@INC)
{
my $file = "$dir/$modname";
if (-r $file)
{
# at this point, things look safe
# let's blatantly untaint the name and pass it on
$classname =~ /^(.*)$/;
return Class::MOP::load_class($1);
}
}
# couldn't find it; return false
return undef;
}
and here's the method that calls my load_class (note this is a
legacy--i.e. non-Moose--class):
sub business_model {
my( $self, %args ) = @_;
unless ( exists $self->{business_model} ) {
# This is just to avoid circular dependencies
Company::Moose::load_class( 'Company::CompanyBusinessModel' );
unless ( eval { $self->{business_model} =
Company::CompanyBusinessModel->new(company => $self) } ) {
if ($@ =~ /company has no properties/) {
$self->{business_model} = undef;
}
else {
die; # unknown error; just rethrow
}
}
}
return $self->{business_model};
}
Is that what you had in mind?
-- Buddy