<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl

use strict;
use warnings;
use LWP::Simple;
use XML::XPath;
use Data::Dumper;

use constant NOMRAL_DISPLAY =&gt; "\e[0;0m";
use constant UNDERLINE =&gt; "\e[0;4m";

use constant HOSTNAME =&gt; "http://services.aonaware.com";
use constant DICTIONARY =&gt; "gcide";
use constant STRATEGY =&gt; "lev";
use constant DEFINE_URL =&gt; 
	HOSTNAME . "/DictService/DictService.asmx/DefineInDict?dictId=" . DICTIONARY . "&amp;word="; 

my $rawXml = get(DEFINE_URL . $ARGV[0]);
my $xp = XML::XPath-&gt;new(xml =&gt; $rawXml);
my $data = $xp-&gt;find('//Definition/WordDefinition');
if ($data-&gt;size == 0) {
  print "No Matches for $ARGV[0]\n";
} else {   
	my $count = 1;
	for my $def ($data-&gt;get_nodelist) { 
  	print UNDERLINE . "DEFINITION $count" . NOMRAL_DISPLAY . "\n";
  	print $def-&gt;string_value . "\n";
  	$count++;
	}
}
  	
=head1 NAME

Dictionary

=head1 DESCRIPTION
  	
A command line dictionary that uses the aonaware.com dictionary webservice.  	
  	
=head1 README

THIS SOFTWARE DOES NOT COME WITH ANY WARRANTY WHATSOEVER. USE AT YOUR OWN RISK.
Please check out my blog at http://grepmonster.wordpress.com if you like this script.

=head1 PREREQUISITES

This script requires the LWP::Simple and XML::XPath modules

=head1 COREQUISITES

CGI

=pod OSNAMES

any

=pod SCRIPT CATEGORIES

CPAN/Administrative
Educational

=cut


</pre></body></html>