my $query = CGI->new(\&hook); sub hook { my ($filename, $buffer, $bytes_read,$data) = @_; $cache->set($progress_key, [0, $bytes_read]); }