package HBCU::Spider::Data;

use warnings;
use strict;

my @params = qw(
		content
		images
		error
		title
		url
		links
	       );


# Create the accessor/mutator methods
for my $meth (@params) {
  $meth = lc $meth;
  no strict "refs";
  *$meth = sub {
    my $self = shift;
    $self->{uc $meth} = shift if @_;
    return $self->{uc $meth};
  }
}

################################################################################
sub new {
  my $invocant = shift;
  my $self = {
	      CONTENT => undef,
	      IMAGES => [],
	      ERROR => undef,
	      TITLE => undef,
	      URL => undef,
	      LINKS => [],
	     };

  $invocant = ref $invocant || $invocant;

  bless($self, $invocant);

  return $self;
}

################################################################################
sub addImage {
  my $self = shift;

  push @{$self->images}, shift;
}

################################################################################
sub addLink {
  my $self = shift;

  push @{$self->links}, shift;
}

################################################################################
sub clearError {
  my $self = shift;

  $self->error( undef );
}

################################################################################
sub emptyImages {
  my $self = shift;

  $self->images( [] );
}

################################################################################
sub emptyLinks {
  my $self = shift;

  $self->links( [] );
}

1;
