[PATCH 2/8] extrahd.cgi: Refactor code to use new introduced perl functions.