Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Change this while ($head_txt =~ m/\G(.+?)$mycrlf/g) { to while ($head_txt =~ m/\G(.+?)$mycrlf/go) { I'm assuming the $mycrlf never changes, right?
    --

    --
    xoa

    • by rjbs (4671) on 2006.11.29 8:47 (#51948) Homepage Journal
      I'm afraid that mycrlf does. It's the line ending that's used in the given email. There are two regex involved: $crlf and $mycrlf. The former matches any valid line ending, the latter matches those which are expected in this header.

      If I use $crlf, I should be safe, and that is constant. Switching to use that and enabling /o didn't really help, though.

      Here's the better thing, though. It seems that I was wrong in my belief that I couldn't use a /g pattern on a dereferenced string. I don't know why I couldn't get it working yesterday, but now I can. I'm back to using the /g pattern, with no copy of the string, and memory usage is further down:
      ~/code/pep/Email-Simple/trunk$ perl -I lib  readmail headers.msg
        just started                :   1360    28328
        after require File::Slurp   :   2228    28704
        after slurping              :  12192    38656
        after require Email::Simple :  12256    38656
        after construction          :  48268    66844
      --
      rjbs