File: devel_callparser.t

package info (click to toggle)
libdevel-declare-perl 0.006019-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 376 kB
  • ctags: 150
  • sloc: ansic: 752; perl: 608; makefile: 3
file content (28 lines) | stat: -rw-r--r-- 465 bytes parent folder | download | duplicates (5)
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
use warnings;
use strict;

use Test::More;
use Test::Requires 'Devel::CallParser';

plan tests => 1;

use Devel::CallParser ();

sub method {
	my ($usepack, $name, $inpack, $sub) = @_;
	no strict "refs";
	*{"${inpack}::${name}"} = $sub;
}

use Devel::Declare method => sub {
	my ($usepack, $use, $inpack, $name) = @_;
	return sub (&) { ($usepack, $name, $inpack, $_[0]); };
};

method bar {
	return join(",", @_);
};

is +__PACKAGE__->bar(qw(x y)), "main,x,y";

1;