[Catalyst] How to get IP address of the interface which the request come through

Craig Chant craig at homeloanpartnership.com
Mon Mar 25 09:14:15 GMT 2013

I use


-----Original Message-----
From: N.A. [mailto:n-a at u01.gate01.com]
Sent: 23 March 2013 12:13
To: The elegant MVC web framework
Subject: [Catalyst] How to get IP address of the interface which the request come through

I wan to get the  IP address of the interface(network device) which the request come through.
This information can be easily obtained by

 "$c->engine->env->{ SERVER_ADDR }"

with FCGI setting both on nginx/lighttpd web servers.
However SERVER_ADDR is not defined in "Catalyst Test Server."

Of course the network device is usually 'eth0', but in some situation the network device can be 'virbr0' , 'wlan0','eth1' and so on.
Are there any simple and portable way to get the information.

I use Catalyst of version 5.90020 on linux box.


List: Catalyst at lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/
This Email and any attachments contain confidential information and is intended solely for the individual to whom it is addressed. If this Email has been misdirected, please notify the author as soon as possible. If you are not the intended recipient you must not disclose, distribute, copy, print or rely on any of the information contained, and all copies must be deleted immediately. Whilst we take reasonable steps to try to identify any software viruses, any attachments to this e-mail may nevertheless contain viruses, which our anti-virus software has failed to identify. You should therefore carry out your own anti-virus checks before opening any documents. HomeLoan Partnership will not accept any liability for damage caused by computer viruses emanating from any attachment or other document supplied with this e-mail. HomeLoan Partnership reserves the right to monitor and archive all e-mail communications through its network. No representative or employee of HomeLoan Partnership has the authority to enter into any contract on behalf of HomeLoan Partnership by email. HomeLoan Partnership is a trading name of H L Partnership Limited, registered in England and Wales with Registration Number 5011722. Registered office: 26-34 Old Street, London, EC1V 9QQ. H L Partnership Limited is authorised and regulated by the Financial Services Authority.

More information about the Catalyst mailing list