How to log someone’s IP Address when submitting a form?

So I need to create the ability for a user to submit a form – and I would like to enable some sort of primitive security system. To that end, I need to work out a way to check IP addresses.  All this while in PERL (it’s pretty damn simple in PHP and Ruby on Rails). Let’s see what I can find (hopefully..)

-edit-

Well that wasn’t so bad.

render_text request.env['REMOTE_HOST'].to_s

-edit-

So it turns out that this doesn’t always work. There is a better way to do so; try this.


render_text request.remote_ip().to_s