#!/usr/bin/perl
use strict;
use warnings;
# first, create your message
use Email::MIME;
my $message = Email::MIME->create(
header_str => [
From => 'you@example.com',
To => 'friend@example.com',
Subject => 'Happy birthday!',
],
attributes => {
encoding => 'quoted-printable',
charset => 'ISO-8859-1',
},
body_str => "Happy birthday to you!\n",
);
# send the message
use Email::Sender::Simple qw(sendmail);
sendmail($message); Can't locate Email/MIME.pm in @INC (you may need to install the Email::MIME module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.28.1 /usr/local/share/perl/5.28.1 /usr/lib/x86_64-linux-gnu/perl5/5.28 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.28 /usr/share/perl/5.28 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at testemail.pl line 6.
BEGIN failed--compilation aborted at testemail.pl line 6.
#!/usr/bin/perl
print "Content-type: text/plain\n\n";
print "testing...\n"; #!/usr/bin/perl -w
BEGIN {
use CGI::Carp qw(carpout);
open(LOG, ">>/home/********/public_html/cgi-bin/errors-log") or
die("Unable to open errors-log: $!\n");
carpout(LOG);
}
use strict;
use warnings;
Can't locate Email/MIME.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /home/********/public_html/cgi-bin/testemail.pl line 14.
BEGIN failed--compilation aborted at /home/********/public_html/cgi-bin/testemail.pl line 14.
CGI::Carp qw is the same on the other issue. Apparently CGI.pm HAS BEEN REMOVED FROM THE PERL COREand I thought it might help here.
CGI::Carp for error reporting and it does seem that these days there are alternate methods.
It does seem that CGI is a pure Perl module, and replacing it is a lot of work,...
CGI.pm HAS BEEN REMOVED FROM THE PERL CORE
If you upgrade to a new version of perl or if you rely on a system or vendor perl and get an updated version of perl through a system update, then you will have to install CGI.pm yourself with cpan/cpanm/a vendor package/manually.
Thanks, it could be similar, the messages I had were related to Email/MIME.pm though.
see this: https://metacpan.org/pod/distribution/CGI/lib/CGI.pod#CGI.pm-HAS-BEEN-REMOVED-FROM-THE-PERL-CORE
in other words, CGI.pm doesn't have to be replaced to get your application working, it just needs to be a separately installed module once perl has been upgraded by your host.
i wouldn't necessarily recommend replacing CGI.pm on an existing application.
fyi this is some CPAN documentation on CGI alternatives [metacpan.org]
it could be similar in the sense that if your host did a perl update perhaps you have to reinstall any non-standard modules you are using (such as Email/MIME)
see this for a list of standard modules:
https://perldoc.perl.org/modules#Standard-Modules
[edited by: phranque at 1:08 am (utc) on Feb 6, 2021]
[edit reason] unlinked urls [/edit]
as of October 4, 2020:
It came up in another issue and apparently involved CPanel changes.
[edited by: phranque at 1:11 am (utc) on Feb 6, 2021]
in fact, CGI.pm was removed from the perl core in perl 5.22:
[perldoc.perl.org...]
perl 5.22 was released june 1, 2015:
[nntp.perl.org...]
recent updates of hosting software can make old deprecations news.
the hosting company have to allow my access to the compiler, as I need to install Perl modules to even run the small test script
... the CGI::Fast module has been split into its own distribution, meaning you do not need access to a compiler to install CGI.pm