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

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

Replies are listed 'Best First'.
Re^6: send mail cgi
by cavac (Prior) on May 10, 2021 at 09:35 UTC

    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";'