Commit e2483d5e authored by Michael Hanus 's avatar Michael Hanus

Package spec refined, file renamed

parent 28d81444
Pipeline #510 failed with stages
......@@ -4,11 +4,13 @@
"author": "Michael Hanus <mh@informatik.uni-kiel.de>",
"synopsis": "Library for dealing with URLs",
"category": [ "Web" ],
"dependencies": { },
"exportedModules": [ "URL" ],
"dependencies": {
"base" : ">= 1.0.0, < 2.0.0"
},
"exportedModules": [ "System.URL" ],
"compilerCompatibility": {
"pakcs": ">= 1.14.0",
"kics2": ">= 0.5.0"
"pakcs": ">= 2.0.0, < 3.0.0",
"kics2": ">= 2.0.0, < 3.0.0"
},
"license": "BSD-3-Clause",
"licenseFile": "LICENSE",
......
......@@ -2,25 +2,26 @@
--- Library for dealing with URLs (Uniform Resource Locators).
---
--- @author Michael Hanus
--- @version November 2003
--- @category web
--- @version October 2019
------------------------------------------------------------------------------
module URL(getContentsOfUrl) where
module System.URL ( getContentsOfUrl ) where
import System
import IOExts(readCompleteFile)
import Directory ( getTemporaryDirectory )
import FilePath ( (</>) )
import System ( getPID, system )
import IOExts ( readCompleteFile )
--- Reads the contents of a document located by a URL.
--- This action requires that the program "wget" is in your path,
--- otherwise the implementation must be adapted to the local
--- installation.
getContentsOfUrl :: String -> IO String
getContentsOfUrl url = do
tmpdir <- getTemporaryDirectory
pid <- getPID
let tmpfile = "/tmp/wgeturl."++show pid
system ("wget -O "++tmpfile++" \""++url++"\"")
let tmpfile = tmpdir </> "wgeturl." ++ show pid
system $ "wget -O " ++ tmpfile ++ " \"" ++ url ++ "\""
cont <- readCompleteFile tmpfile
system ("rm -f "++tmpfile)
system $ "rm -f "++tmpfile
return cont
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment