September 2022 Archives

Sending a simple email

To have a secure SMTP delivery, use Email::Sender. Mail::Sendmail uses SMTP for transport and there's no other type of transport. It does not support SMTP authentication, which my SMTP server now requires even for access from localhost. From what I read and tried once or twice in the past, the current "best practice" or recommended way is to use Email::Sender. Here's an incantation to send mail using sendmail:

Saving Perl packages through local

In Perl there is an expression local. It substitutes the specified value with undef until the end of the block. The values can be global hashes, arrays and scalars, as well as elements or slices of hashes and scalars. The problem is that package hashes are not saved by local. By package hashes I mean a hash with a colon at the end (%Package::) which stores the package symbols (GLOB).

package A {
  sub fn {}
  $x = 10;
  @x = qw(1 2);
}

use DDP;
p %A::  # -> {
        #    fn   *A::fn  (layers: ),
        #    x    *A::x  (layers: )
        # }…

About Den

user-pic Old dev