Created
October 29, 2012 15:23
-
-
Save b10m/3974165 to your computer and use it in GitHub Desktop.
Fetch a random animal name suited for wiki page tagging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ perl -MMojo::UserAgent -le 'Mojo::UserAgent->new->detect_proxy | |
->get("http://en.wikipedia.org/wiki/Chart_of_English_animal_nouns") | |
->res->dom->find("table.wikitable tr td a") | |
->shuffle->slice(0..2)->each(sub { print $_->text } );' |
Use a proxy where needed.
~ $ echo $http_proxy
http://proxy_from_work:3128
~ $ perl -MMojo::UserAgent -le 'print Mojo::UserAgent->new
->get("http://en.wikipedia.org/wiki/Chart_of_English_animal_nouns")
->res->dom->find("table.wikitable tr td a")
->shuffle->first->text;'
Can't call method "text" on an undefined value at -e line 1.
~ $
There, added ->detect_proxy for you ;)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can't call method "text" on an undefined value at -e line 4.