Well, for one think you didn't follow the suggestions by kvale. Also, your loadFile function is wrong. Try this instead:
# this file reads a text file and loads the contents into
# an array
sub loadFile($)
{
my $self = shift;
my ($filename) = @_;
open (FILE, "<$filename") or die("cannot open the file: $filename"
+);
while (<FILE>) {
$body .= $_;
}
close(FILE);
return($body);
}
Update:
Also, your calls to HTML::pageParser are incorrect. They should read:
my $myPage = HTML::pageParser->new($sysLoc);
$myPage->{tokens}{fName} = "Brandon"; #definite problem here, dunno ho
+w to format this
$myPage->{tokens}{lName} = "Smith"; #definite problem here, dunno ho
+w to format this
$data = $myPage->loadAndParse("parseThis.txt");
See if this makes a difference.
|