use Test::More tests => 3;
use_ok('CGI') or die;
can_ok('CGI', 'start_html');
ok(CGI->start_html, '... and calling it should succeed');
####
package Foo;
use stub qw'this that';
sub AUTOLOAD {...} # required
####
sub _delegate {
# this is not a complete method. It's just here for illustration
my ($self, $slot, $object) {
$self->{$slot}{object} = $object;
my @missing;
foreach my $method (@{$self->{$slot}{methods}}) {
push @missing => $method unless UNIVERSAL::can($object, $method);
}
die "Interface required @missing" if @missing;
return $self;
}
####
package stub;
sub import {
my @stub_methods = @_;
my ($package) = caller;
foreach my $stub (@stub_methods) {
*{"$package::$stub"} = sub { goto &AUTOLOAD };
}
}
1;