in reply to Re^2: extracting name & email address
in thread extracting name & email address

Is this how to approach this ?

Maybe

Consider

Main( @ARGV ); exit( 0 ); sub Main { my @files = RecursivePathSearch( $path ); for my $file ( @files ){ SomethingHere( $file ); } } sub RecursivePathSearch { my( $path ) = @_; use File::Find::Rule qw/ find rule/ return rule( file => not_name => [ '*.pl', ], )->in( $path ); } sub SomethingHere { my( $file ) = @_; use Path::Tiny qw/ path /; use Email::Address; my $stuff = path( $file )->slurp_raw; return Email::Address->parse( $stuff ); }

Replies are listed 'Best First'.
Re^4: extracting name & email address
by peterr (Scribe) on Feb 23, 2015 at 09:08 UTC
    Thanks, just had to place a ";" on the 'find rule/' line. Then ran it and a msg appeared "Complex regular subexpression recursion limit (32766) exceeded at /usr/share/perl5/Email/Address.pm line 108."

    There are only 3 sub folders though in that path.

      weeel, you might try line-by-line reading of file if slurping is too much :) ... alternatively Email::Find for getting addresses
        trt
        weeel, you might try line-by-line reading of file if slurping is too much :) ... alternatively Email::Find for getting addresses

        I don't think it is the slurping that is producing those errors (regex), as I have had the same error message in code without Slurp.

        The error messages appear to be produced when the line my @addrs = Email::Address->parse( $stuff ); is executed. But not all the time; seems to be only when $stuff contains attachments that are not plain text or html.

        If Slurp can selectively parse only plain text or html, that would be great. Basically, no processing on the other attachment types.