]> git.proxmox.com Git - pmg-api.git/commitdiff
postifx: code cleanup
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 3 Feb 2022 10:04:32 +0000 (11:04 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 3 Feb 2022 10:04:34 +0000 (11:04 +0100)
avoid a overly long line and a useless overwriting a scalar only to
extend another one with its value, really no biggie especially in the
context that's used, but its so easy to avoid that it still has some
merit.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PMG/API2/Postfix.pm
src/PMG/Postfix.pm

index 2dfcc11a47bfd9ef20f0b969b49fd6c10a4c0dc1..be47923c0374aab1cf5175f14dcd5df3509ec18e 100644 (file)
@@ -253,7 +253,7 @@ __PACKAGE__->register_method ({
 
        $param->{header} //= 1;
 
-       return PMG::Postfix::postcat($param->{queue_id}, $param->{header}, $param->{body}, $param->{'decode-header'});
+       return PMG::Postfix::postcat($param->@{qw(queue_id header body decode-header)});
     }});
 
 __PACKAGE__->register_method ({
index 20f980e7fe60eb330fe5055883a071639b854802..43270c8edce274f67ec0918ae378e81e377f22a6 100644 (file)
@@ -180,9 +180,10 @@ sub postcat {
     my $res = '';
     while (defined(my $line = <$fh>)) {
        if ($decode) {
-           $line = mime_to_perl_string($line);
+           $res .= mime_to_perl_string($line);
+       } else {
+           $res .= $line;
        }
-       $res .= $line;
     }
 
     return $res;