package Dictionary;
#############
# Demonstration in class on 11/20.
# See ../dict_example.pl and the POD docs at the end of this file.
############

use 5.008;
use strict;
use warnings;
our $VERSION = '0.02';

# ADD CODE

# Create a new dictionary object.
sub new {
  my $class = shift;
  my $self  = {};
  bless $self, $class;
  return $self;
}

# return true if a give word exists in the dictionary.
sub lookup {
  my $self = shift;
  my ($word_to_find) = @_;
  my $dict_file = "/usr/share/dict/words";
  while (my $word = <DICT>){
    if ( $word_to_find =~ /$word/i ){
      return 1;
    }
  }
  return 0;
}



1;
__END__

=head1 NAME

Dictionary - Perl extension that shows an example of 
reading from the unix dictionary file and playing with it.

=head1 SYNOPSIS

  use Dictionary;
  my $dict = Dictionary->new();
  print " 'foo' is a word\n" if $dict->lookup('foo');
  my $random_word = $dict->random();
  my $random_three_letter_word = $dict->random(3);

=head1 ABSTRACT

  This should be the abstract for Dictionary.
  Fill it out, eh?

=head1 DESCRIPTION

Put the description here.

=head1 SEE ALSO

perl.

=head1 AUTHOR

Jim Mahoney, E<lt>mahoney@marlboro.edu<gt>

=head1 COPYRIGHT AND LICENSE

Copyright 2003 by Jim Mahoney

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself. 

=cut
