1use strict;
2use warnings;
3
4package Test::Tester::Delegate;
5
6our $VERSION = '1.302175';
7
8use Scalar::Util();
9
10use vars '$AUTOLOAD';
11
12sub new
13{
14	my $pkg = shift;
15
16	my $obj = shift;
17	my $self = bless {}, $pkg;
18
19	return $self;
20}
21
22sub AUTOLOAD
23{
24	my ($sub) = $AUTOLOAD =~ /.*::(.*?)$/;
25
26	return if $sub eq "DESTROY";
27
28	my $obj = $_[0]->{Object};
29
30	my $ref = $obj->can($sub);
31	shift(@_);
32	unshift(@_, $obj);
33	goto &$ref;
34}
35
36sub can {
37	my $this = shift;
38	my ($sub) = @_;
39
40	return $this->{Object}->can($sub) if Scalar::Util::blessed($this);
41
42	return $this->SUPER::can(@_);
43}
44
451;
46