in reply to Re^3: send mail cgi
in thread send mail cgi

Thanks. This is new to me. All perl for apache or nginx. I was used to use on administration, small tasks. I want to use Mojolicious to websites. This was copied to try to have an email sender on the company. I need to improve more.

Replies are listed 'Best First'.
Re^5: send mail cgi
by Bod (Parson) on May 06, 2021 at 22:28 UTC
    I want to use Mojolicious to websites

    There are other options which avoid CGI.pm. I have recently changed from hard coding HTML into Perl scripts to using Template. It took a little time to get started with it but it is so much faster and simpler to develop. Pick a framework or templating system and use that, don't even think about CGI.pm

      I've been using Template since 2008. It's extremely handy. And it's sort of easy enough to write your own "plugins" as well, like support for multi-language lookups in your database.

      ... use base qw(Template::Plugin); use Template::Plugin; use Template::Exception; sub load { my ($class, $context) = @_; my $self = bless { }, $class; return $self; } sub new { my ($self, $context) = @_; return $self; } ... sub tr { my ($self, $data) = @_; return $data if($data eq ''); my $lang = $self->getLang; my $trans = tr_translate($lang, $data); return $trans; } ...

      And suddenly, you can call [% tr.tr("Hello World") %] in your Template and have your backend insert the correct klingon translation.

      perl -e 'use Crypt::Digest::SHA256 qw[sha256_hex]; print substr(sha256_hex("the Answer To Life, The Universe And Everything"), 6, 2), "\n";'