From d0ffe11bd365b68d4da252b39d06d99f75d8cacb Mon Sep 17 00:00:00 2001 From: "Jannis M. Hoffmann" Date: Wed, 16 Nov 2022 23:14:10 +0100 Subject: minor cleanup and fixes --- lib/JWebmail/Model/ReadMails/MockJSON.pm | 6 +++--- lib/JWebmail/Model/ReadMails/QMailAuthuser.pm | 3 +-- lib/JWebmail/Model/WriteMails.pm | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) (limited to 'lib/JWebmail/Model') diff --git a/lib/JWebmail/Model/ReadMails/MockJSON.pm b/lib/JWebmail/Model/ReadMails/MockJSON.pm index 1a16ef6..b90a630 100644 --- a/lib/JWebmail/Model/ReadMails/MockJSON.pm +++ b/lib/JWebmail/Model/ReadMails/MockJSON.pm @@ -3,10 +3,10 @@ package JWebmail::Model::ReadMails::MockJSON; use v5.24; use warnings; use utf8; +use autodie; use List::Util 'sum'; - -use Mojo::JSON 'decode_json'; +use JSON::PP 'decode_json'; use Digest::HMAC_MD5 'hmac_md5_hex'; use Role::Tiny::With; @@ -28,7 +28,7 @@ sub _read_json_file { use constant PREFIX => 't/private/'; - open(my $body_file, '<', PREFIX . $file_name); + open my $body_file, '<', PREFIX . $file_name; local $/; my $body = <$body_file>; close $body_file; diff --git a/lib/JWebmail/Model/ReadMails/QMailAuthuser.pm b/lib/JWebmail/Model/ReadMails/QMailAuthuser.pm index d0d2b3c..39d8ab6 100644 --- a/lib/JWebmail/Model/ReadMails/QMailAuthuser.pm +++ b/lib/JWebmail/Model/ReadMails/QMailAuthuser.pm @@ -190,10 +190,9 @@ sub execute { binmode $reader, ':encoding(UTF-8)'; my $input = <$reader>; - close $reader + close $reader # waits for the child to finish or die 'closing read pipe failed'; - waitpid($pid, 0); my $rc = $? >> 8; my $resp; diff --git a/lib/JWebmail/Model/WriteMails.pm b/lib/JWebmail/Model/WriteMails.pm index f4d09e8..05c4cd1 100644 --- a/lib/JWebmail/Model/WriteMails.pm +++ b/lib/JWebmail/Model/WriteMails.pm @@ -29,7 +29,7 @@ sub _build_mail { content_type => $mail->{attach_type}, encoding => 'base64', }, - body => $mail->{attach}->asset->slurp, + body => $mail->{attach}->asset->slurp(), ) : undef; my $email = Email::MIME->create( @@ -44,7 +44,7 @@ sub _build_mail { $email->header_str_set(CC => @{$mail->{cc}}) if $mail->{cc}; $email->header_str_set('Reply-To' => $mail->{reply}) if $mail->{reply}; - return $email->as_string; + return $email->as_string(); } @@ -53,7 +53,7 @@ sub _send { open(my $m, '|-', 'sendmail', '-i', @recipients) or die 'Connecting to sendmail failed. Is it in your PATH?'; - $m->print($mime->as_string); + $m->print($mime->as_string()); close($m); return $? >> 8; } -- cgit v1.2.3