The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
use strict;
use warnings;
use Test::More tests => 2;
use Devel::Declare::MethodInstaller::Simple;

BEGIN {
  Devel::Declare::MethodInstaller::Simple->install_methodhandler(
    name => 'method',
    into => 'main',
  );
}

ok(!main->can('foo'), 'foo() not installed yet');

method foo {
    $_[0]->method
}

ok(main->can('foo'), 'foo() installed at runtime');