HTTP::WebTest::Plugin::Loader - Loads external plugins


HTTP-WebTest documentation Contained in the HTTP-WebTest distribution.

Index


Code Index:

NAME

Top

HTTP::WebTest::Plugin::Loader - Loads external plugins

SYNOPSIS

Top

Not Applicable

DESCRIPTION

Top

This plugin lets you to load external HTTP::WebTest plugins.

TEST PARAMETERS

Top

plugins

GLOBAL PARAMETER

A list of module names. Loads these modules and registers them as HTTP::WebTest plugins. If the name of the plugin starts with ::, it is prepended with HTTP::WebTest::Plugin. So

    plugins = ( ::Click )

is equal to

    plugins = ( HTTP::WebTest::Plugin::Click )

COPYRIGHT

Top

SEE ALSO

Top

HTTP::WebTest

HTTP::WebTest::API (HTTP::WebTest::API)

HTTP::WebTest::Plugin

HTTP::WebTest::Plugins (HTTP::WebTest::Plugins)


HTTP-WebTest documentation Contained in the HTTP-WebTest distribution.
# $Id: Loader.pm,v 1.7 2003/03/02 11:52:09 m_ilya Exp $

package HTTP::WebTest::Plugin::Loader;

use strict;

use base qw(HTTP::WebTest::Plugin);

use HTTP::WebTest::Utils qw(load_package);

sub param_types {
    return q(plugins list);
}

sub start_tests {
    my $self = shift;

    $self->global_validate_params(qw(plugins));

    my $plugins = $self->global_test_param('plugins');

    for my $plugin (@$plugins) {
	my $name = $plugin;

	if($name =~ /^::/) {
	    $name = 'HTTP::WebTest::Plugin' . $name;
	}

	load_package($name);

	push @{$self->webtest->plugins}, $name->new($self->webtest);
    }
}

1;