|
NAMEWebService::CIA::Parser - Parse pages from the CIA World Factbook SYNOPSISuse WebService::CIA::Parser; my $parser = WebService::CIA::Parser->new; my $data = $parser->parse($string); DESCRIPTIONWebService::CIA::Parser takes a string of HTML and parses it. It will only give sensible output if the string is the HTML for a page whose URL matches "https://www.cia.gov/library/publications/the-world-factbook/print/[a-z]{2}\.html" This parsing is somewhat fragile, since it assumes a certain page structure. It'll work just as long as the CIA don't choose to alter their pages. METHODS
EXAMPLE use WebService::CIA::Parser;
use LWP::Simple qw(get);
$html = get(
"https://www.cia.gov/library/publications/the-world-factbook/print/uk.html"
);
$parser = WebService::CIA::Parser->new;
$data = $parser->parse($html);
print $data->{"Population"};
AUTHORIan Malpass (ian-cpan@indecorous.com) COPYRIGHTCopyright 2003-2007, Ian Malpass This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The CIA World Factbook's copyright information page (<https://www.cia.gov/library/publications/the-world-factbook/docs/contributor_copyright.html>) states: The Factbook is in the public domain. Accordingly, it may be copied freely without permission of the Central Intelligence Agency (CIA). SEE ALSOWebService::CIA
|