Mathew Snyder wrote:
> Rob Dixon wrote:
>> Mathew Snyder wrote:
>>> Mathew Snyder wrote:
>>>> I can't seem to get this working.  Every time I try to run it
>>>> segfaults on me.
>>>> I've removed it from my code and reverted to the stage I was at
>>>> before I added
>>>> it and my script worked exactly as it did before I put it in.  I've
>>>> installed it
>>>> via both cpan and yum.  I've tried running it on a SuSE box and two
>>>> Fedora Core
>>>> 5 boxes.  I get the same result both times.
>>>>
>>>> Does anyone know if this is a buggy module?  Version is 1.883-1
>>>>
>>>> Mathew
>>>>
>>> I looked over the doc for this module.  It looks like the parse() method
>>> requires one argument which is a list of email addresses to look for.
>>> The way I
>>> have it set up I think I may be passing the source of an entire web
>>> page to it.
>> OK it seems to dislike newlines in the content it's parsing. Make sure this
>> works for you and, if so, you can apply the same fix to your own data.
>> In the
>> meantime I shall make some time to find the problem in the module (it
>> just hangs
>> on my machine).
>>
>> Rob
>>
>>
>> use strict;
>> use warnings;
>>
>> use LWP::Simple;
>> use Email::Address;
>>
>> my $data = get
>> 'http://search.cpan.org/~rjbs/Email-Address-1.884/lib/Email/Address.pm';
>> $data =~ s/\s+/ /g;
>>
>> my @addrs = Email::Address->parse($data);
>>
>> print $_->address, "\n" foreach @addrs;
>>
>>
>
> 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;
> };
>
>
> This is an example of the text I'm parsing:

[snip]

Look at the code below. Is this what you get?

Rob


use strict;
use warnings;

use Email::Address;

my $data = q|
<tr class="oddline" ><td class="collection-as-table" >   <b><a
href="/Ticket/Display.html?id=52549">52549</a></b></td><td
class="collection-as-table" ><b><a
href="/Ticket/Display.html?id=52549">***POSSIBLE SPAM*** Of fight a
implicit</a></b></td><td class="collection-as-table" >open</td><td
class="collection-as-table" >Security</td><td class="collection-as-table"
> >msnyder</td><td class="collection-as-table" >62</td></tr><tr class="oddline"
> ><td class="collection-as-table" ></td><td class="collection-as-table"
> ><small>[EMAIL PROTECTED]</small></td><td class="collection-as-table"
> ><small>13 hours ago</small></td><td class="collection-as-table"
> ><small></small></td><td class="collection-as-table" ><small>13 hours
ago</small></td><td class="collection-as-table" ><small>0</small></td></tr>
|;

my @addrs = Email::Address->parse($data);

print $_->address, "\n" foreach @addrs;

**OUTPUT**

[EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to