On 12/6/06, Rob Dixon <[EMAIL PROTECTED]> wrote:
Mathew Snyder wrote: > > This is the meat of what I have. It looks like it should work exactly as you > have only a bit more explicitly. All it does is return me to the prompt. I > know there should be at least 100 emails in the text I'm parsing. In fact, I've > figured out how to do this with HTML::TokeParser and am getting several hits. I > just need to figure out how to eliminate things I don't want. > > my $agent = WWW::Mechanize->new(); > $agent->get('https://rt.ops.servervault.com/'); > > $agent->submit_form( > form_name => 'login', > fields => { > 'user' => $user, > 'pass' => $pass, > } > ); > > $agent->follow_link(text => "Tickets"); > > $agent->submit_form( > form_name => 'BuildQuery', > fields => { > 'ValueOfStatus' => $status, > 'ValueOfActor' => $user, > 'ValueOfQueue' => $queue, > }, > button => 'DoSearch' > ); > > $agent =~ s/\s+/ /g; > my @emails = Email::Address->parse($agent); > > foreach my $email (@emails){ > print $email; > };OK, here's your problem. Sorry, I overlooked it before. You're trying to parse the WWW::Mechanize agent itself instead of the contents of the current page. You had it correct in your previous post! Try: my $data = $agent->content; my @emails = Email::Address->parse($data); print $_->address, "\n" foreach @emails; and if you're having trouble add in the $data =~ s/\s+/ /g line before parsing it. HTH, Rob
That may be the solution, but it isn't the problem. Or rather, it's only one problem. Regardless of whether E::A->parse() succeeds or fails, and of whether on success it returns the expected result, Matthew should never be seeing something die with SIGSEGV. That, combined with the fact that nobody else seems to be getting a segfault leads me to believe that something in Matthew's installation of Mech or one of its dependencies, or possibly even the Perl RE, didn't compile correctly. E::A->parse quite happily accepts the Mech object for me. It doesn't return anything useful, but it doesn't segfault. Email::Address is a pure Perl module with no XS. It should never dump core. Die perhaps, but not segfault. Something's fishy here. -- jay -------------------------------------------------- This email and attachment(s): [ ] blogable; [ x ] ask first; [ ] private and confidential daggerquill [at] gmail [dot] com http://www.tuaw.com http://www.downloadsquad.com http://www.engatiki.org values of β will give rise to dom!
