[Haskell-cafe] Network.CGI strangeness

Alexander Solla alex.solla at gmail.com
Thu Jul 21 22:25:15 CEST 2011


Hi Everybody,

I'm having some strange issues with Network.CGI's pathInfo action, or else
some other strangeness with pattern matching.

My "mainCGI" CGI action is:

mainCGI :: CGI CGIResult
mainCGI = pathInfo >>= outputSlotTHtml . packagesPage

outputSlotTHtml is irrelevant to my problem.  packagesPage generates a SlotT
IO Html -- Slot semantics are essentially irrelevant to my problem.  But
packagesPage calls a function called pathCrossRef which is having some
problems:

packagesPage :: WebPath -> SlotT IO Html
packagesPage wp = do
     infos <- getPackageInfos . pathCrossRef $ wp
     ...

pathCrossRef :: String -> String
pathCrossRef "/working/" = "/development/code/haskell/working/"
pathCrossRef _           = "/development/code/haskell/packages/"

The intention is that when the cgi program is called with "/working/" as an
argument, the pathCrossRef should point at "/development/.../working/", and
when called with "/packages/" (or anything else) as an argument,
pathCrossRef should point to "/development/.../packages/".

But it is not working!  When I visit http://localhost/working/, I end up
using the "packages" cross ref.  I have even printed the cgi argument to the
Apache log, and the argument is "/working/".  If I get rid of the wildcard
pattern, I get a "missing pattern" error when I visit
http://localhost/working/.  Can anybody help?

Thanks,
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110721/3c4cb02b/attachment.htm>


More information about the Haskell-Cafe mailing list