I have following code:
my $coderef = ${MyModule::MyTool->new};
but when I try
$coderef->();
i got error:
Not a CODE re
This should work regardless of which package holds the new:
my $coderef = MyModule::MyTool->UNIVERSAL::can( 'new' );
So that if MyModule::MyTool does not implement their constructor, you can still get it's handle.
MyModule::MyTool