Net::MW::API - use Merriam-Webster dictionay API in Perl
use Net::MW::API; my $mw = Net::MW::API->new(dict => "collegiate", word => "$the-word-to-query", key => "$your-key-here"); my $xml = $mw->raw_xml; # a string my $dom = $mw->dom; # XML::LibXML::Document my @entries = $mw->entries(); # @entries is list of XML::LibXML::Element my $audio_uri = $mw->audio_url; # ex. http://media.merriam-webster.com/soundc11/t/test0001.wav
Net::MW::API is an api to merriam-webster.com dictionary. It gives you xml result based on your query. it use XML::LibXML to process the XML result (very basic). If you need to get the value of specific node, probably you need to deal with the xml yourself.
has 'dict' => ( is => 'rw', isa => 'Str', required => 1 );
the dictionary you want to use
has 'word' => ( is => 'rw', isa => 'Str', required => 1 );
the word to query
has 'key' => ( is => 'ro', isa => 'Str', required => 1 );
the query url based on $dict, $word, $key
reference: http://www.dictionaryapi.com/api/v1/references/$dic/xml/$word?key=$key
the xml you get based on your query
the dom (XML::LibXML::Document) base on your query
the @entries of dom
the audio url of the query word
Hao Wu <echowuhao@gmail.com>
Copyright 2013- Hao Wu
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
XML::LibXML
To install Net::MW::API, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::MW::API
CPAN shell
perl -MCPAN -e shell install Net::MW::API
For more information on module installation, please visit the detailed CPAN module installation guide.