Update of /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest
In directory usw-pr-cvs1:/tmp/cvs-serv24803/lib/HTTP/WebTest
Modified Files:
Plugin.pm
Log Message:
Cache values of test parameters
Index: Plugin.pm
===================================================================
RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Plugin.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Plugin.pm 15 Feb 2002 13:13:39 -0000 1.6
--- Plugin.pm 15 Feb 2002 14:48:01 -0000 1.7
***************
*** 159,162 ****
--- 159,165 ----
}
+ # reference on hash which caches return value of subroutine calls
+ *_sub_cache = make_access_method('_SUB_CACHE', sub { {} });
+
# searches passed data structure for code references and replaces them
# with value returned by referenced subs
***************
*** 166,170 ****
if(ref($value) eq 'CODE') {
! $value = $value->();
}
--- 169,180 ----
if(ref($value) eq 'CODE') {
! # check if value is in cache; value returned from subroutine
! # is cached so we don't evaluate test parameter value more
! # than one time
! unless(${$self->_sub_cache}{$value}) {
! ${$self->_sub_cache}{$value} = $value->();
! }
!
! $value = ${$self->_sub_cache}{$value};
}
|