2 ms·
Interesting things can happen with M::UA in a single line: use Mojo::UserAgent; print Mojo::UserAgent->new->get('http://freegeoip.net/json/8.8.8.8')->res->
by kgtm 15y ago
Interesting things can happen with M::UA in a single line:
use Mojo::UserAgent;
print Mojo::UserAgent->new->get('http://freegeoip.net/json/8.8.8.8')->res->json->{country_name};
Very powerful.
- draegtun 15y agoIndeed. And there are many more nice examples in the cookbook: http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#USER_AGENT http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#USER... Also check out the command line interface which allows you todo things like this: $ mojo get http://mojolicio.us 'head > title' ref: http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Command_line http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Comm...