[Http-webtest-general] Re: perl objects in HTTP::WebTest
Brought to you by:
m_ilya,
richardanderson
From: Ilya M. <il...@ma...> - 2003-04-03 20:08:24
|
>>>>> On Thu, 3 Apr 2003 09:46:41 -0500, Gerry Finkel <ga...@cs...> said: GF> All, GF> [..snip..] GF> I have a base class called TestCase. Extended from that is a class for a GF> specific page/servlet that I'm interacting with. I seem to be corrupting GF> some data (specifically my URL) after several gets/posts are sent to the GF> servlet. GF> Below is several chunks of code which I hope will explain what I'm GF> doing. There's a comment in the leftmost column where I see the problem. GF> Each of my classes have genFunc() methods for generating arrays of URLs GF> which generate the queries I need. I do things like GF> my $numlist = Csf::ListMgmt->new(); GF> $webtest->run_tests($numlist->genGetWholeList($listid)); GF> to generate my test runs. GF> I guess my main question is, is it safe to reference $self inside GF> on_request? And can I say things like $self->anotherMethod() inside GF> on_request? Is this just a bad thing to do? There is nothing wrong with it. You have a closure and unless Perl has a bug it should work just as you expect it to work: i.e when HTTP::WebTest calls it you get your Csf::ListMgmt object inside of your on_request handler and you should be able to call its methods. Can you elaborate 'I seem to be corrupting some data ...' please? Do you mean that HTTP::WebTest's objects change unexpectedly or do you mean that Csf::ListMgmt object changes unexpectedly? BTW it is hard to tell for sure without seeing all code but should not be it easier to rewrite your testing code as a plugin instead of using on_request hooks? GF> [..snip..] -- Ilya Martynov, il...@ip... CTO IPonWEB (UK) Ltd Quality Perl Programming and Unix Support UK managed @ offshore prices - http://www.iponweb.net Personal website - http://martynov.org |