Update of /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest
In directory usw-pr-cvs1:/tmp/cvs-serv22192/lib/HTTP/WebTest
Modified Files:
API.pm
Log Message:
Now $wt->run_wtscript may accept string with tests
Index: API.pm
===================================================================
RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/API.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** API.pm 26 May 2002 20:04:22 -0000 1.12
--- API.pm 7 Jun 2002 08:57:50 -0000 1.13
***************
*** 143,147 ****
}
! =head2 run_wtscript ($file, $optional_params)
Reads wtscript and runs tests it defines.
--- 143,147 ----
}
! =head2 run_wtscript ($wtscript, $optional_params)
Reads wtscript and runs tests it defines.
***************
*** 151,157 ****
=over 4
! =item * $file
! A filename of wtscript file.
=item * $optional_params
--- 151,160 ----
=over 4
! =item * $wtscript
! Either a filename of wtscript file or wtscript passed as string. Very
! simple heuristic is used distinguish first from second. If
! C<$wtscript> contains either C<\n> or C<\r> it is treated like
! wtscript string. Otherwise it is filename.
=item * $optional_params
***************
*** 166,180 ****
sub run_wtscript {
my $self = shift;
! my $file = shift;
my $opts_override = shift || {};
! my $fh = new IO::File;
! $fh->open("< $file") or
! die "HTTP::WebTest: Can't open file $file: $!";
! my $data = join '', <$fh>;
! $fh->close;
! my ($tests, $opts) = $self->parse($data);
$self->run_tests($tests, { %$opts, %$opts_override });
--- 169,186 ----
sub run_wtscript {
my $self = shift;
! my $wtscript = shift;
my $opts_override = shift || {};
! unless($wtscript =~ /[\r\n]/) {
! my $fh = new IO::File;
! my $file = $wtscript;
! $fh->open("< $file") or
! die "HTTP::WebTest: Can't open file $file: $!";
! $wtscript = join '', <$fh>;
! $fh->close;
! }
! my ($tests, $opts) = $self->parse($wtscript);
$self->run_tests($tests, { %$opts, %$opts_override });
|