При попытке использования скрипта с archwiki выскакивает сообщение об ошибке:
[user@comp-core-i5-d3b45e .scripts]$ sudo perl /home/user/.scripts/imap.pl
[sudo] password for user:
socket(): Name or service not known at /home/user/.scripts/imap.pl line 13.
#!/usr/bin/perl
# gimap.pl by gxmsgx
# description: get the count of unread messages on imap
use strict;
use Mail::IMAPClient;
use IO::Socket::SSL;
my $username = 'имя_пользователя';
my $password = 'пароль123';
my $socket = IO::Socket::SSL->new(
PeerAddr => 'imap.server',
PeerPort => 993
)
or die "socket(): $@";
my $client = Mail::IMAPClient->new(
Socket => $socket,
User => $username,
Password => $password,
)
or die "new(): $@";
if ($client->IsAuthenticated()) {
my $msgct;
$client->select("INBOX");
$msgct = $client->unseen_count||'0';
print "$msgct\n";
}
$client->logout();