[Mojolicious] How to get remote ip

1,910 views
Skip to first unread message

Иван Соколов

unread,
May 25, 2010, 2:58:57 AM5/25/10
to Mojolicious
Hi all!

How can i get remote ip where i run my app as daemon or daemon_prefork?
If a run my app as cgi i get remote ip from $self->req->env({REMOTE_ADDR});
But i didn't find how to get it in other modes.

P.S. Sebastian, thank you for Mojolocious. It is realy great!

--
Ivan Sokolov

--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To post to this group, send email to mojol...@googlegroups.com.
To unsubscribe from this group, send email to mojolicious...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mojolicious?hl=en.

Иван Соколов

unread,
May 25, 2010, 3:01:20 AM5/25/10
to Mojolicious
Oh, sorry. I get it from $self->req->env->{REMOTE_ADDR};

2010/5/25 Иван Соколов <vanes...@gmail.com>:
> Hi all!
>
> How can i get remote ip where i run my app as daemon or daemon_prefork?
> If a run my app as cgi i get remote ip from $self->req->env({REMOTE_ADDR});
> But i didn't find how to get it in other modes.
>
> P.S. Sebastian, thank you for Mojolocious. It is realy great!
>
> --
> Ivan Sokolov
>



--
С уважением,
Иван

Eugene Ardarov

unread,
May 25, 2010, 3:18:37 AM5/25/10
to mojol...@googlegroups.com
In your controller it is $self->tx->remote_address

2010/5/25 Иван Соколов <vanes...@gmail.com>:

Анатолий Шарифулин

unread,
May 25, 2010, 3:21:48 AM5/25/10
to mojol...@googlegroups.com
Usually I use Dumper $self or $tx, and find answer :)

2010/5/25 Eugene Ardarov <splee...@gmail.com>
In your controller it is $self->tx->remote_address

2010/5/25 Иван Соколов <vaneska.ru@gmail.com>:
> Oh, sorry. I get it from $self->req->env->{REMOTE_ADDR};
>
> 2010/5/25 Иван Соколов <vaneska.ru@gmail.com>:
>> Hi all!
>>
>> How can i get remote ip where i run my app as daemon or daemon_prefork?
>> If a run my app as cgi i get remote ip from $self->req->env({REMOTE_ADDR});
>> But i didn't find how to get it in other modes.
>>
>> P.S. Sebastian, thank you for Mojolocious. It is realy great!
>>
>> --
>> Ivan Sokolov
>>
>
>
>
> --
> С уважением,
> Иван
>
> --
> You received this message because you are subscribed to the Google Groups "Mojolicious" group.
> To post to this group, send email to mojol...@googlegroups.com.
> To unsubscribe from this group, send email to mojolicious...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mojolicious?hl=en.
>
>

--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To post to this group, send email to mojol...@googlegroups.com.
To unsubscribe from this group, send email to mojolicious...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mojolicious?hl=en.




--
С уважением,
Анатолий Шарифулин.

Иван Соколов

unread,
May 25, 2010, 3:32:53 AM5/25/10
to mojol...@googlegroups.com
> Usually I use Dumper $self or $tx, and find answer :)
> In your controller it is $self->tx->remote_address

Thanks!
I use it too. But today i slept vary little time and my brains don't
work at all.
It sometimes happens :)
So very thank you again :)
--
Ivan Sokolov

Sebastian Riedel

unread,
May 25, 2010, 6:42:49 AM5/25/10
to mojol...@googlegroups.com
> In your controller it is $self->tx->remote_address

This is the right answer, try not to rely on ->req->env, because it's not portable.

--
Sebastian Riedel
http://labs.kraih.com
http://mojolicious.org
http://twitter.com/kraih

Sebastian Riedel

unread,
May 25, 2010, 6:45:20 AM5/25/10
to mojol...@googlegroups.com
> P.S. Sebastian, thank you for Mojolocious. It is realy great!

Glad you like it. :)
Reply all
Reply to author
Forward
0 new messages