in reply to Sub on the fly?
However, that would only work if you were within the blork package, so if you wanted to install the method from main:: then this *blork::foo = sub { ... } is more approriate.
{ no strict 'refs'; *{ $class . '::' . $name } = sub { ... }; } [download]