Created
March 26, 2011 21:27
-
-
Save moritz/888651 to your computer and use it in GitHub Desktop.
Cute Mojo::UserAgent example
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
use 5.012; | |
use Mojo::UserAgent; | |
use warnings; | |
binmode STDOUT, ':encoding(UTF-8)'; | |
my $ua = Mojo::UserAgent->new(); | |
my $r = $ua->get('http://www.loc.gov/standards/iso639-2/php/code_list.php'); | |
for my $row ($r->res->dom('tr')->each) { | |
my ($three, $two, $english_name, $french_name) = | |
map $_->text, $row->find('td')->each; | |
say "$two $english_name" if length($two) == 2; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment