You have mixed two distinct concepts: handlers and actions. You'd have to write a module to introduce new handler into the httpd server. After that, you'd have to use AddHandler or SetHandler to actually bind it with certain file type and/or URL space.
You would have to double check your error logs, but I suspect that while serving the .lgml file Apache figured out, that lgm-cgi handler doesn't exist and fell back to default-handler, which served your file as flat text.
You are correct however, to use Action here as it is appropriate. You just need to use it a bit differently. First, you should introduce a custom type for your file:
AddType application/lgml .lgml
...then associate that type with your action:
Action application/lgml /usr/local/bin/lgm -c
This should work.
EDIT: As pointed out by kbro, 2nd argument to Action
should be a CGI Script. So you'd have to write one (lets say /cgi-bin/lgm-handler.sh
) which would call /usr/local/bin/lgm
under the hood. Then you would introduce it into the server as such:
Action application/lgml /cgi-bin/lgm-handler.sh