]> www.average.org Git - pdns-pipe-nmc.git/blob - test.hs
replaceable backend and test prototype
[pdns-pipe-nmc.git] / test.hs
1 {-# LANGUAGE OverloadedStrings #-}
2
3 module Main where
4
5 import Prelude hiding (readFile)
6 import Data.ByteString.Lazy (ByteString)
7 import Data.ByteString.Lazy.Char8 (unpack, readFile)
8 import System.IO.Error
9 import Control.Exception
10
11 import NmcDom
12
13 queryOp :: ByteString -> IO (Either String ByteString)
14 queryOp key = catch (readFile ("data/" ++ (unpack key)) >>= return . Right)
15                     (\e -> return (Left (show (e :: IOException))))
16
17 main = do
18         d <- queryDom queryOp "root"
19         putStrLn $ show d
20