gossamer has asked for the wisdom of the Perl Monks concerning the following question:
The example subject I'm working with that spans two lines is as follows:use strict; use Advisory; use MIME::Parser; use MIME::Entity; use MIME::WordDecoder; use MIME::Tools; use MIME::Decoder; use Email::MIME; my $parser = MIME::Parser->new; + + + $parser->extract_uuencode(1); $parser->extract_nested_messages(1); $parser->output_to_core(1); my $buf; while(<STDIN> ){ $buf .= $_; } my @mailData = split( '\n', $buf); my $entity = $parser->parse_data($buf); my $subject = $entity->head->get('Subject'); my $from = $entity->head->get('From'); my $AdvDate = $entity->head->get('Date'); my $linecount = 0; my $inadvis = 0; foreach my $line (@mailData) { chomp($line); if ($line =~ m/^Description:/) { $startShort = "true"; next; } if ($linecount lt 5 && $startShort eq "true") { $shortDesc .= $line . " "; $linecount++; } #print "line: $line\n"; # MGASA-2018-0463 - Updated roundcubemail packages fix securit +y vulnerability & bugs # MGASA-2018-0439 - Updated ansible package fixes security vul +nerabilities #print "line: $line\n"; if ($line =~ m/MGASA-(\d+)-(\d+) - Updated (.*) package/) { $pkgname = $3; $subject = "Mageia $1-$2: $3 security update"; $inadvis = 1; } # MGASA-2019-0151 - Virtualbox 6.0.6 fixes security vulnerabil +ities elsif ($line =~ m/MGASA-(\d+)-(\d+) - (.*) (.*) fixes security + vulnerabilities/) { $pkgname = $3; $subject = "Mageia $1-$2: $3 security update"; $inadvis = 1; } # [updates-announce] MGASA-2023-0355: New chromium-browser-sta +ble 120.0.6099.129 fixes bugs and vulnerabilities elsif ($line =~ m/MGASA-(\d+)-(\d+): New (.*) (.*) fixes bugs +and/) { $pkgname = $3; $subject = "Mageia $1-$2: $3 security update"; $inadvis = 1; } if ($inadvis == 1) { $advisory .= $line . "\n"; } }
I've put the entire mbox email in a paste hereSubject: [updates-announce] MGASA-2023-0355: New chromium-browser-stab +le 120.0.6099.129 fixes bugs and vulnerabilities
https://pastebin.com/LRs9J4pd
Any ideas greatly appreciated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: MIME::Parser and multi-line subjects
by choroba (Cardinal) on Dec 26, 2023 at 23:07 UTC | |
by gossamer (Sexton) on Dec 26, 2023 at 23:55 UTC |