Re: ->study() loops
Russell Mosemann <[email protected]> Fri, 22 Oct 2004 14:06:40 -0500 (CDT)
| Newsgroups | gmane.comp.lang.perl.modules.mail-box |
|---|---|
| Message-ID | <[email protected]> |
On Fri, 22 Oct 2004, Mark Overmeer wrote: > * Russell Mosemann ([email protected]) [041022 18:54]: > > I have a program that goes through the attachments of a message and > > attempts to get the content type with > > > > if (defined($type = $attachment->study("Content-Type"))) > > It may be the problem which was detected and solved by Anthony D. Urso > last week, which had to do with superfluous blanks on the line. Try > to change Mail/Message/Field/Structured method parse($) > > $self->datum($datum); > > my $found = ''; > - until($string eq '') > + while($string =~ m/\S/) > { if($string =~ s/^\;\s*// && length $found) > { my $attr = Mail::Message::Field::Attribute->new($found); > Hmm. That doesn't do it, because there is a space before the semicolon. In the file msg.txt, the colon appears on the next line indented by one space. Here are the debug lines. Before consumeComment string * ; format="flowed" * Before consumePhrase string * ; format="flowed" * Loop end I believe that the correct fix for this problem is $self->datum($datum); my $found = ''; - until($string eq '') + while($string =~ m/\S/) - { if($string =~ s/^\;\s*// && length $found) + { if($string =~ s/^\s*\;\s*// && length $found) { my $attr = Mail::Message::Field::Attribute->new($found); ---- Russell Mosemann, Ph.D. * Computing Services * Concordia University, Nebraska "Eschew obfuscation!"