Update of /cvsroot/http-webtest/HTTP-WebTest-Recorder/lib/HTTP/WebTest/Recorder
In directory sc8-pr-cvs1:/tmp/cvs-serv18476/lib/HTTP/WebTest/Recorder
Modified Files:
Controller.pm
Added Files:
Actions.pm
Removed Files:
Action.pm
Log Message:
Rename package Action to Actions
--- NEW FILE: Actions.pm ---
package HTTP::WebTest::Recorder::Actions;
use strict;
use HTTP::WebTest::Parser;
sub default_action {
my $controller = shift;
return(controller => $controller);
}
sub enable_action {
my $controller = shift;
my $enable = $controller->cgi->param('enable');
$controller->recorder->is_recording($enable);
$controller->redirect('list');
}
sub list_action {
my $controller = shift;
return(default_action($controller),
tests => $controller->recorder->tests);
}
sub request_action {
my $controller = shift;
my $num = $controller->cgi->param('num');
my $test = $controller->recorder->tests->[$num];
return(default_action($controller),
test => $test);
}
sub wtscript_action {
my $controller = shift;
my $wtscript = (join "\n", map _test2wtscript($_),
@{$controller->recorder->tests});
return(default_action($controller),
wtscript => $wtscript);
}
sub _test2wtscript {
my $test = shift;
my @params = map +($_ => $test->params->{$_}), sort keys %{$test->params};
return HTTP::WebTest::Parser->write_test(\@params);
}
1;
Index: Controller.pm
===================================================================
RCS file: /cvsroot/http-webtest/HTTP-WebTest-Recorder/lib/HTTP/WebTest/Recorder/Controller.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Controller.pm 1 Feb 2003 22:25:33 -0000 1.2
--- Controller.pm 1 Feb 2003 22:29:58 -0000 1.3
***************
*** 12,16 ****
use HTTP::WebTest::Recorder::Exceptions;
! use HTTP::WebTest::Recorder::Action;
# constructor
--- 12,16 ----
use HTTP::WebTest::Recorder::Exceptions;
! use HTTP::WebTest::Recorder::Actions;
# constructor
***************
*** 34,42 ****
use vars qw(%DISPATCH);
! %DISPATCH = (list => \&HTTP::WebTest::Recorder::Action::list_action,
! request => \&HTTP::WebTest::Recorder::Action::request_action,
! wtscript => \&HTTP::WebTest::Recorder::Action::wtscript_action,
! enable => \&HTTP::WebTest::Recorder::Action::enable_action,
! default => \&HTTP::WebTest::Recorder::Action::default_action);
# serves requests for web interface of the proxy
--- 34,42 ----
use vars qw(%DISPATCH);
! %DISPATCH = (list => \&HTTP::WebTest::Recorder::Actions::list_action,
! request => \&HTTP::WebTest::Recorder::Actions::request_action,
! wtscript => \&HTTP::WebTest::Recorder::Actions::wtscript_action,
! enable => \&HTTP::WebTest::Recorder::Actions::enable_action,
! default => \&HTTP::WebTest::Recorder::Actions::default_action);
# serves requests for web interface of the proxy
--- Action.pm DELETED ---
|