What is the easiest way in pure Perl to stream from another HTTP resource?

前端 未结 5 1260
闹比i
闹比i 2021-01-01 00:01

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

5条回答
  •  时光取名叫无心
    2021-01-01 00:14

    Wait, I don't understand. Why are you ruling out a separate process? This:

    open my $stream, "-|", "curl $url" or die;
    while(<$stream>) { ... }
    

    sure looks like the "easiest way" to me. It's certainly easier than the other suggestions here...

提交回复
热议问题