| 1 | # $Id: Loader.pm,v 1.7 2003/03/02 11:52:09 m_ilya Exp $ | ||||||||||
| 2 | |||||||||||
| 3 | package HTTP::WebTest::Plugin::Loader; | ||||||||||
| 4 | |||||||||||
| 5 | =head1 NAME | ||||||||||
| 6 | |||||||||||
| 7 | HTTP::WebTest::Plugin::Loader - Loads external plugins | ||||||||||
| 8 | |||||||||||
| 9 | =head1 SYNOPSIS | ||||||||||
| 10 | |||||||||||
| 11 | Not Applicable | ||||||||||
| 12 | |||||||||||
| 13 | =head1 DESCRIPTION | ||||||||||
| 14 | |||||||||||
| 15 | This plugin lets you to load external L<HTTP::WebTest|HTTP::WebTest> | ||||||||||
| 16 | plugins. | ||||||||||
| 17 | |||||||||||
| 18 | =cut | ||||||||||
| 19 | |||||||||||
| 20 | 10 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | |||||||||||
| 22 | 10 | ▶ | use base qw(HTTP::WebTest::Plugin); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | |||||||||||
| 24 | 10 | ▶ | use HTTP::WebTest::Utils qw(load_package); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 25 | |||||||||||
| 26 | =head1 TEST PARAMETERS | ||||||||||
| 27 | |||||||||||
| 28 | =for pod_merge copy params | ||||||||||
| 29 | |||||||||||
| 30 | =head2 plugins | ||||||||||
| 31 | |||||||||||
| 32 | I<GLOBAL PARAMETER> | ||||||||||
| 33 | |||||||||||
| 34 | A list of module names. Loads these modules and registers them as | ||||||||||
| 35 | L<HTTP::WebTest|HTTP::WebTest> plugins. If the name of the plugin starts with | ||||||||||
| 36 | C<::>, it is prepended with C<HTTP::WebTest::Plugin>. So | ||||||||||
| 37 | |||||||||||
| 38 | plugins = ( ::Click ) | ||||||||||
| 39 | |||||||||||
| 40 | is equal to | ||||||||||
| 41 | |||||||||||
| 42 | plugins = ( HTTP::WebTest::Plugin::Click ) | ||||||||||
| 43 | |||||||||||
| 44 | =cut | ||||||||||
| 45 | |||||||||||
| 46 | 82 | ▶ | sub param_types { | ||||||||
|
Subroutine
param_types: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 47 | 82 | return q(plugins list); | |||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | 82 | ▶ | sub start_tests { | ||||||||
|
Subroutine
start_tests: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 51 | 82 | my $self = shift; | |||||||||
| 52 | |||||||||||
| 53 | 82 | $self->global_validate_params(qw(plugins)); | |||||||||
| 54 | |||||||||||
| 55 | 82 | my $plugins = $self->global_test_param('plugins'); | |||||||||
| 56 | |||||||||||
| 57 | 82 | for my $plugin (@$plugins) { | |||||||||
| 58 | 27 | my $name = $plugin; | |||||||||
| 59 | |||||||||||
| 60 | 27 | ▶ | if($name =~ /^::/) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 61 | 22 | $name = 'HTTP::WebTest::Plugin' . $name; | |||||||||
| 62 | } | ||||||||||
| 63 | |||||||||||
| 64 | 27 | load_package($name); | |||||||||
| 65 | |||||||||||
| 66 | 27 | push @{$self->webtest->plugins}, $name->new($self->webtest); | |||||||||
| 67 | } | ||||||||||
| 68 | } | ||||||||||
| 69 | |||||||||||
| 70 | =head1 COPYRIGHT | ||||||||||
| 71 | |||||||||||
| 72 | Copyright (c) 2001-2003 Ilya Martynov. All rights reserved. | ||||||||||
| 73 | |||||||||||
| 74 | This program is free software; you can redistribute it and/or modify | ||||||||||
| 75 | it under the same terms as Perl itself. | ||||||||||
| 76 | |||||||||||
| 77 | =head1 SEE ALSO | ||||||||||
| 78 | |||||||||||
| 79 | L<HTTP::WebTest|HTTP::WebTest> | ||||||||||
| 80 | |||||||||||
| 81 | L<HTTP::WebTest::API|HTTP::WebTest::API> | ||||||||||
| 82 | |||||||||||
| 83 | L<HTTP::WebTest::Plugin|HTTP::WebTest::Plugin> | ||||||||||
| 84 | |||||||||||
| 85 | L<HTTP::WebTest::Plugins|HTTP::WebTest::Plugins> | ||||||||||
| 86 | |||||||||||
| 87 | =cut | ||||||||||
| 88 | |||||||||||
| 89 | 10 | 1; | |||||||||