1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
#!perl
use warnings FATAL => 'all';
use strict;
use Test::More tests => 8;
{
package TX;
sub check { 1 }
our $obj;
BEGIN { $obj = bless {}, 'TX'; }
}
use Function::Parameters {
fun => {
strict => 1,
reify_type => sub {
my ($type) = @_;
my $package = caller;
if ($package ne $type) {
my (undef, $file, $line) = @_;
diag "";
diag "! $file : $line";
}
is $package, $type;
$TX::obj
},
},
};
fun f1(main $x) {}
fun Asdf::f1(main $x) {}
{
package Foo::Bar::Baz;
fun f1(Foo::Bar::Baz $x) {}
fun Ghjk::f1(Foo::Bar::Baz $x) {}
package AAA;
fun f1(AAA $x) {}
fun main::f2(AAA $x) {}
}
fun f3(main $x) {}
fun Ghjk::f2(main $x) {}
|