What is the easiest way (without opening a shell to curl and reading from stdin) in Perl to stream from another HTTP resource? I'm assuming here that the HTTP resource I'm reading from is a potentially infinite stream (or just really, really long)
相关问题
- Angular RxJS mergeMap types
- $ENV{$variable} in perl
- Google Apps Script: testing doPost() with cURL
- How to instantiate Http service in main.ts manuall
- C#使用http访问网络,有办法用指定网卡访问网络嘛?
相关文章
- C#使用http访问网络,有办法用指定网卡访问网络嘛?
- Is a unicode user agent legal inside an HTTP heade
- Running a perl script on windows without extension
- Comparing speed of non-matching regexp
- git: retry if http request failed
- Can NOT List directory including space using Perl
- Flutter - http.get fails on macos build target: Co
- Extracting columns from text file using Perl one-l
Event::Lib will give you an easy interface to the fastest asynchronous IO method for your platform.
IO::Lambda is also quite nice for creating fast, responsive, IO applications.
Wait, I don't understand. Why are you ruling out a separate process? This:
sure looks like the "easiest way" to me. It's certainly easier than the other suggestions here...
HTTP::Lite's
request
method allows you to specify a callback.However, looking at the source, there seems to be a bug inIt seems safer to usesub request
in that it seems to ignore the passed callback.set_callback
:Output:
It looks like a callback passed to the
request
method is treated differently:Good old LWP allows you to process the result as a stream.
E.g., here's a callback to yourFunc, reading/passing byte_count bytes to each call to yourFunc (you can drop that param if you don't care how large the data is to each call, and just want to process the stream as fast as possible):