summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/JWebmail/Controller/Webmail.pm7
-rw-r--r--lib/JWebmail/Model/ReadMails/MockJSON.pm2
-rw-r--r--lib/JWebmail/Model/ReadMails/MockMaildir.pm2
-rw-r--r--lib/JWebmail/Model/ReadMails/QMailAuthuser.pm6
-rw-r--r--lib/JWebmail/Model/ReadMails/Role.pm2
-rw-r--r--lib/JWebmail/Plugin/Helper.pm6
6 files changed, 13 insertions, 12 deletions
diff --git a/lib/JWebmail/Controller/Webmail.pm b/lib/JWebmail/Controller/Webmail.pm
index c61c493..ce18de8 100644
--- a/lib/JWebmail/Controller/Webmail.pm
+++ b/lib/JWebmail/Controller/Webmail.pm
@@ -194,13 +194,14 @@ sub readmail {
my $auth = $self->stash(ST_AUTH);
my $mail;
- eval { $mail = $self->users->show($auth, $mid) };
- if (my $err = $@) {
+ my $ok = eval { $mail = $self->users->show($auth, $mid); 1 };
+ if (!$ok) {
+ my $err = $@;
if ($err =~ m/unkown mail-id|no such message/) {
$self->reply->not_found;
return;
}
- die $@;
+ die;
}
# select a single body element
diff --git a/lib/JWebmail/Model/ReadMails/MockJSON.pm b/lib/JWebmail/Model/ReadMails/MockJSON.pm
index 345573c..1a16ef6 100644
--- a/lib/JWebmail/Model/ReadMails/MockJSON.pm
+++ b/lib/JWebmail/Model/ReadMails/MockJSON.pm
@@ -21,7 +21,7 @@ use constant {
with 'JWebmail::Model::ReadMails::Role';
-sub new { bless {} }
+sub new { bless {}, shift }
sub _read_json_file {
my ($file_name) = @_;
diff --git a/lib/JWebmail/Model/ReadMails/MockMaildir.pm b/lib/JWebmail/Model/ReadMails/MockMaildir.pm
index d1746ec..2df4fa9 100644
--- a/lib/JWebmail/Model/ReadMails/MockMaildir.pm
+++ b/lib/JWebmail/Model/ReadMails/MockMaildir.pm
@@ -35,7 +35,7 @@ sub build_and_run {
my $args = shift;
my $mail_user = 'maildir';
- my $exec = $EXTRACTORS{$self->extractor} . ' ' . join(' ', map { $_ =~ s/(['\\])/\\$1/g; "'$_'" } ($self->maildir, $self->user, $mail_user, $mode, @$args));
+ my $exec = $EXTRACTORS{$self->extractor} . ' ' . join(' ', map { my $x = s/(['\\])/\\$1/gr; "'$x'" } ($self->maildir, $self->user, $mail_user, $mode, @$args));
my $pid = open(my $reader, '-|', $exec)
or die 'failed to create subprocess';
diff --git a/lib/JWebmail/Model/ReadMails/QMailAuthuser.pm b/lib/JWebmail/Model/ReadMails/QMailAuthuser.pm
index 09b8b9d..d0d2b3c 100644
--- a/lib/JWebmail/Model/ReadMails/QMailAuthuser.pm
+++ b/lib/JWebmail/Model/ReadMails/QMailAuthuser.pm
@@ -31,7 +31,7 @@ package JWebmail::Model::ReadMails::QMailAuthuser::Error {
$self->{data} = $_[0] if @_ == 1;
$self->{data} = [@_] if @_ > 1;
- return bless $self;
+ return bless $self, $cls;
}
sub to_string {
@@ -169,7 +169,7 @@ sub build_arg {
return $self->{qmail_dir}.'/bin/qmail-authuser'
. $self->{prefix} . ' '
- . join(' ', map { s/(['\\])/\\$1/g; "'$_'" } ($self->{prog}, $self->{maildir}, $self->{user}, $user_name, $mode, @$args))
+ . join(' ', map { my $x = s/(['\\])/\\$1/gr; "'$x'" } ($self->{prog}, $self->{maildir}, $self->{user}, $user_name, $mode, @$args))
. ' 3<&0'
. ' 2>>'.$self->{logfile};
}
@@ -188,7 +188,7 @@ sub execute {
close $writer
or die 'closing write pipe failed';
- binmode $reader, ':utf8';
+ binmode $reader, ':encoding(UTF-8)';
my $input = <$reader>;
close $reader
or die 'closing read pipe failed';
diff --git a/lib/JWebmail/Model/ReadMails/Role.pm b/lib/JWebmail/Model/ReadMails/Role.pm
index 466e3b0..593672c 100644
--- a/lib/JWebmail/Model/ReadMails/Role.pm
+++ b/lib/JWebmail/Model/ReadMails/Role.pm
@@ -9,7 +9,7 @@ package JWebmail::Model::ReadMails::Role::Shadow {
use overload '""' => sub { '***' };
- sub new { shift; bless \(shift.'') }
+ sub new { my $cls = shift; bless \(shift.''), $cls }
sub show_password { ${shift()} }
diff --git a/lib/JWebmail/Plugin/Helper.pm b/lib/JWebmail/Plugin/Helper.pm
index 86fea26..8323a61 100644
--- a/lib/JWebmail/Plugin/Helper.pm
+++ b/lib/JWebmail/Plugin/Helper.pm
@@ -82,10 +82,10 @@ sub print_sizes2 {
}
-my sub d { "([[:digit:]]{$_[0]})" }
+my sub dgt { "([[:digit:]]{$_[0]})" }
sub parse_iso_date {
- state $rx = do { my $re = d(4).'-'.d(2).'-'.d(2).'T'.d(2).':'.d(2).':'.d(2); qr/$re/a };
+ state $rx = do { my $re = dgt(4).'-'.dgt(2).'-'.dgt(2).'T'.dgt(2).':'.dgt(2).':'.dgt(2); qr/$re/a };
my @d = shift =~ /$rx/;
if (@d != 6) {
# TODO
@@ -129,7 +129,7 @@ our %MIME_Render_Subs = (
sub mime_render {
my ($c, $enc, $cont) = @_;
- ($enc) = $enc =~ m"^(\w+/\w+);?";
+ ($enc) = $enc =~ m<^(\w+/\w+);?>;
my $renderer = $MIME_Render_Subs{$enc} // return '';
return $renderer->($c, $cont);