Re: Simulation of modem connections [& ping reply]

Ed (ed@chronos.net)
Wed, 3 Mar 1999 00:19:42 +0000 (WET)


On Tue, 2 Mar 1999, BAZLEY Sebastian wrote:
[...]
> So I think I need a way to simulate slow modems. I am currently
> experimenting with a local copy of IO::Handle, intending to modify
> sysread/syswrite to add suitable delays, based on the packet size. [Or I
> guess I could amend LWP::Protocol::HTTP etc and add the delays there.]
> Does anyone else have any other suggestions ? Has this been done before ? Am
> I barking up the wrong tree ?!

I haven't heard of this sort of thing being wanted before, and the
approaches you suggest all sound plausible. I think hacking up a
special version of LWP::P::http sounds like the quickest way to
get the result, though you might add a new LWP::Protocol::httpslow,
and make GET/PUT requests to httpslow://wherever rather than the
normal http://whatever. Hope this helps.

> P.S. Ping response: yes, Ed, I did get your posting (LWP::Simple::post, also
> ping request)

Thanks for replying. Have we heard anything from Gisle Aas lately?
I had e-mailed him my patch a while ago, and haven't heard back.

> P.P.S. I am not very experienced in writing Perl modules, so there may be a
> better way of adding hooks or replacing code in a module other than just
> modifying a clone of it ...

Well, the textbook way of doing it is "supposed" to be subclassing,
which I suppose has its merits. I find it suspect when one has to
subclass off a module to get any use from it; the designer should
probably have made the API flexible enough in the first place :-)
No hard & fast rules can be applied, of course.
-- 
Ed          |                         | mailto:ed@chronos.net
Chronos.Net | http://www.chronos.net/ | mailto:info@chronos.net