On 12/19/2006 10:58 PM, Mathew Snyder wrote:
I have a script which runs WWW::Mechanize to obtain a page so it can be parsed
for email addresses. However, I can't recall how I'm supposed to use
HTML::TokeParser to get what I need. This is the pertinent part of the script:
...
my $data = $agent->content();
my $parse = new HTML::TokeParser($data);
my @emails;
my $token;
while ($data) {
$token = $parse->get_trimmed_text("/small");
push @emails, $token;
}
foreach my $email (@emails){
print $email;
};
This gives me the error Can't call method "get_trimmed_text" on an undefined
value at ./check_delete_users.pl line 40.
I had this working at one point but lost the file. What am I missing?
Mathew
It looks like the invokation of HTML::TokeParser->new() failed.
Read the documentation HTML::TokeParser to find out why. Hint: the "new"
method expects a simple scalar to be a file name.
Also, you get the content of the request not directly from the
user-agent object, but from the response object returned by the "get"
method.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>