Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more documentation and a new function
The new function get_wiki_url gives the URL of the page to retrieve. xt/scrape.t tests the scraping. Use new info method for building the pod.
- Loading branch information
1 parent
638a1b9
commit 3c7983f
Showing
6 changed files
with
140 additions
and
21 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/home/ben/software/install/bin/perl | ||
use warnings; | ||
use strict; | ||
use utf8; | ||
use WWW::Wikipedia::LangTitles 'get_wiki_titles'; | ||
binmode STDOUT, ":encoding(utf8)"; | ||
my $title = 'Three-phase electric power'; | ||
my $links = get_wiki_titles ($title); | ||
print "$title is '$links->{de}' in German.\n"; | ||
my $film = '東京物語'; | ||
my $flinks = get_wiki_titles ($film, lang => 'ja'); | ||
print "映画「$film」はイタリア語で'$flinks->{it}'と名付けた。\n"; | ||
|
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use warnings; | ||
use strict; | ||
use utf8; | ||
use FindBin '$Bin'; | ||
use Test::More; | ||
my $builder = Test::More->builder; | ||
binmode $builder->output, ":utf8"; | ||
binmode $builder->failure_output, ":utf8"; | ||
binmode $builder->todo_output, ":utf8"; | ||
binmode STDOUT, ":encoding(utf8)"; | ||
binmode STDERR, ":encoding(utf8)"; | ||
use WWW::Wikipedia::LangTitles 'get_wiki_titles'; | ||
my $out = get_wiki_titles ('Helium'); | ||
is ($out->{ja}, 'ヘリウム', "Got Japanese title for helium"); | ||
my $outja = get_wiki_titles ('ヘリウム', lang => 'ja'); | ||
is ($outja->{en}, 'Helium', "Got English title with lang => ja and helium in ja"); | ||
|
||
done_testing (); |