File: proxies.t

package info (click to toggle)
libclass-makemethods-perl 1.01-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,944 kB
  • sloc: perl: 10,495; makefile: 2
file content (46 lines) | stat: -rw-r--r-- 780 bytes parent folder | download | duplicates (4)
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
BEGIN {
  eval q{ local $SIG{__DIE__}; require Test::More; 1 };
  if ( $@ ) {
    plan( tests => 1 );
    print "Skipping test on this platform (test requires Test::More).\n";
    ok( 1 );
    exit 0;
  }
}

use Class::MakeMethods::Emulator::mcoder ('-take_namespace');

# Test taken from mcoder 0.05:

package Other;

sub run { "running" }

sub talk { shift; join('-', 'talk', @_) }

sub new { bless {}, shift }



package One;

use mcoder proxy => [other => qw( talk run )];

sub other { shift->{other} }

sub new { bless {other => Other->new}, shift }



package testing;
use Test::More tests => 3;


my $o=One->new;

is($o->run, 'running', 'first proxy');

is($o->talk, 'talk', 'second proxy');

is($o->talk(qw(hello world)),
   'talk-hello-world', 'second proxy with args');