【发布时间】:2017-06-05 02:43:36
【问题描述】:
在以下脚本中:
use strict;
use warnings;
use LWP::Simple;
use threads;
threads->create(sub {
my $url = "http://www.example.com/logo.jpg";
my $file = "/var/www/html/logo.jpg";
getstore($url, $file);
threads->detach();
});
当我启动它时,它不会保存图像,但如果我在线程中启动相同的代码它会起作用,为什么?
【问题讨论】:
-
你为什么使用
threads。 -
我需要同时为多个 url 运行这个脚本
标签: multithreading perl