File: method-installer-runtime.t

package info (click to toggle)
libdevel-declare-perl 0.006017-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 376 kB
  • sloc: ansic: 752; perl: 608; makefile: 2
file content (20 lines) | stat: -rw-r--r-- 361 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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');