tags:

views:

28

answers:

1

A complete noob question, but how exactly do I get values (e.g. path_info) from inside the callback? From the docs, I thought it was a list of tuples, which I thought would make it accessible via lists:keyfind, but I've had no luck. So far, all the examples I've found only show how to print everything with io_lib but not how to access the values by key...

Thanks, --tim

The docs:

Module:Function(SessionID, Env, Input)-> _

Types
    SessionID = term()
    Env = [EnvironmentDirectives] ++ ParsedHeader
    EnvironmentDirectives = {Key, Value}
    Key = query_string | content_length | server_software | gateway_interface | server_protocol | server_port | request_method | remote_addr | script_name. <v>Input = string()
A: 

So, it is as embarrassing as I feared... after figuring out there's a + in front of the debug_info compiler flag instead of a -, I was able to figure out that it is in fact a list of tuples. My problem had to do with my attempting to print it out stdout - didn't like the tuple and was hanging. Anyway,

lists:keyfind(path_info,1,Env). -> {path_info,"/some/path"}

Now, to continue this humbling journey that is learning erlang...

williamstw