summaryrefslogtreecommitdiff
path: root/lib/MaildirIndexer/Parser.pm6
diff options
context:
space:
mode:
Diffstat (limited to 'lib/MaildirIndexer/Parser.pm6')
-rw-r--r--lib/MaildirIndexer/Parser.pm69
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/MaildirIndexer/Parser.pm6 b/lib/MaildirIndexer/Parser.pm6
index e6be32f..a193f75 100644
--- a/lib/MaildirIndexer/Parser.pm6
+++ b/lib/MaildirIndexer/Parser.pm6
@@ -9,7 +9,7 @@ my @separators = (
"\x0d\x0d",
);
-grammar Message {
+my grammar Message {
regex TOP {
<headers>
<separator>
@@ -37,7 +37,7 @@ grammar Message {
token junk { \N+ }
}
-class Message-actions {
+my class Message-actions {
has $.path = IO;
method TOP($/) {
make MaildirIndexer::Email.new(
@@ -58,7 +58,7 @@ class Message-actions {
}
multi parse-email(IO::Path:D $p --> MaildirIndexer::Email) is export {
- return parse-email($p.slurp(:enc<utf8-c8>), path => $p.path);
+ return parse-email($p.slurp(:enc<utf8-c8>), path => $p);
}
multi parse-email(IO::Path:D $p, :$headers-only! --> MaildirIndexer::Email) is export {
@@ -68,7 +68,7 @@ multi parse-email(IO::Path:D $p, :$headers-only! --> MaildirIndexer::Email) is e
:nl-in(@separators),
:!chomp,
)[0],
- path => $p.path,
+ path => $p,
);
}
@@ -84,6 +84,7 @@ multi parse-email(IO::Socket::Async:D $s --> MaildirIndexer::Email) is export {
}
multi parse-email(Str:D $email-str, :$path = IO --> MaildirIndexer::Email) is export {
+ CATCH { warn .perl; return Nil };
with Message.parse($email-str,:actions(Message-actions.new(:$path))) {
return .made;
}