Thanks all for your suggestions. Yeah, it first script I forgot to use https instead of http (or use $ua->max_redirects ).
And in second script updating Mojo from 6.12 to 6.14 was solved the problem :) воскресенье, 28 июня 2015 г., 1:23:53 UTC+3 пользователь Dan Book написал: > > To follow redirects, set > https://metacpan.org/pod/Mojo::UserAgent#max_redirects > > On Sat, Jun 27, 2015 at 6:15 PM, Stefan Adams <[email protected] > <javascript:>> wrote: > >> >> On Sat, Jun 27, 2015 at 5:10 AM, Pavel Serikov <[email protected] >> <javascript:>> wrote: >> >>> Yeah, it's working :) >>> >>> But *warn Dumper >>> ($ua->get('http://geocode-maps.yandex.ru/1.x/?geocode=Москва&format=json')- >>> <http://geocode-maps.yandex.ru/1.x/?geocode=%D0%9C%D0%BE%D1%81%D0%BA%D0%B2%D0%B0&format=json')->>res->json) >>> >>> *doesn't. $VAR1 = undef >>> >>> So problem is in res->json method? >>> >> >> Notice Bernhard's URL had *https*. The http URL you supplied returns a >> 301 redirect to *https*, which of course the 301 response has no JSON in >> the response. >> >> $ perl -MData::Dumper -MMojo::UserAgent -E 'warn Dumper >> (Mojo::UserAgent->new->get(q( >> https://geocode-maps.yandex.ru/1.x/?geocode=Moscow&format=json))- >> >res->json)' >> $VAR1 = { >> 'response' => { >> ... >> } >> }; >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Mojolicious" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at http://groups.google.com/group/mojolicious. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
