If
you have a question on how to do something in Perl, or
you need a Perl solution to an actual real-life problem, or
you're unsure why something you've tried just isn't working...
then this section is the place to ask.
However, you might consider asking in the chatterbox first (if you're a
registered user). The response time tends to be quicker, and if it turns
out that the problem/solutions are too much for the cb to handle, the
kind monks will be sure to direct you here.
Hi i am trying to write an email with my gmx mail account. It requires STARTTLS or TLS. I need to find out some things before i can do this but i first have a question about the difference between the modules Net::SMTP and Net::SMTPS, because it looks like both can do the job. The modules came automattically with my download of strawberry perl. Could someone tell me the difference between them? I have already tried to use the module Net::SMTP::TLS but i got an error on the SSL version and i have heard that it is an outdated module. Any advice is welcome. Ty.
I'm running tests which are in a ./t subdirectory. Tests are failing with "Can't locate so-and-so in @INC", despite the fact that the missing module is in the first directory named in the dump of @INC. I have $PERL5LIB set. Thus:
# perl -v
This is perl 5, version 38, subversion 2 (v5.38.2) built for x86_64-li
+nux-gnu-thread-multi
(with 51 registered patches, see perl -V for more detail)
# cat /etc/os-release
NAME="Linux Mint"
VERSION="22.2 (Zara)"
ID=linuxmint
ID_LIKE="ubuntu debian" ... etc
I'm fairly sure there's a sensible explanation for this baffling behaviour: would someone either diagnose my error, or suggest some way by which I can home in on what it is?
Looks like the consensus on how to approach this would be to "split, sort, join" to generate keys for finding pair pals. Further, as smarter guys explained, using modulo arithmetic voodoo, a lot of unfriendly numbers (which can't have any pals anyway) should simply be skipped; and, of those that remain, it's pointless to ask some of the witnesses about, i.e skip these witnesses, too. So, my subroutine to solve the problem is:
However, even though some solutions mention "speed", I haven't seen optimizations which follow. First, if using CPAN modules is OK (and why not), almost exactly twice as fast is to sort in-place instead:
I have turned perlcritic --stern towards several scripts I have and encountered a question. The manual page for File::Path contains the following excerpt:
Seeking community wisdom on why the ApacheBench utility consistently returns a lot of "Non-2xx responses" ( 502 Bad Gateway ) when running a benchmark test of my helloworld web app using Perl's Net::Async::FastCGI and Nginx as a reverse proxy. The number of concurrent requests is pretty low at 50, but it still return lots of "Non-2xx responses"?? Any insight is greatly appreciated. Please see below for the test code and the ApacheBench command for benchmark test:
1. ApacheBench command: Send 100 requests at concurrency level of 50:
==============================================================================
ab -l -v 2 -n 100 -c 50 "http://localhost:9510/helloworld/"<br/>
...
Concurrency Level: 50
Time taken for tests: 0.015 seconds
Complete requests: 100
Failed requests: 0
Non-2xx responses: 85 #NOTE: all of these are "502 Bad Gateway"
...
I am not thoroughly knowledgeable about the NTFS (my Windows 11 filesystem is NTFS), but it appears there's a portability gotcha in File::Copy::Recursive::Reduced, as illustrated in the console output below:
"C:\berrybrew\instance\5.40.2_64\perl\bin\perl.exe" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib\lib', 'blib\arch')" t/*.t
Unable to symlink C:\Users\somia\AppData\Local\Temp\_VXLTq6lRt\sym to target C:\Users\somia\AppData\Local\Temp\_VXLTq6lRt\old for testing: Operation not permitted at t/001-fcopy.t line 71.
# Looks like your test exited with 1 just after 9.
t/001-fcopy.t ....
Dubious, test returned 1 (wstat 256, 0x100)
Failed 76/85 subtests
(less 1 skipped subtest: 8 okay)
Unable to symlink at t/lib/Helper.pm line 179.
# Looks like your test exited with 1 just after 77.
t/002-dircopy.t ..
Dubious, test returned 1 (wstat 256, 0x100)
Failed 38/115 subtests
(less 1 skipped subtest: 76 okay)
Unable to symlink C:\Users\somia\AppData\Local\Temp\6cvtKrEDFd\sym to target C:\Users\somia\AppData\Local\Temp\6cvtKrEDFd\old for testing: Operation not permitted at t/003-rcopy.t line 78.
# Looks like your test exited with 1 just after 9.
t/003-rcopy.t ....
Dubious, test returned 1 (wstat 256, 0x100)
Failed 179/188 subtests
(less 1 skipped subtest: 8 okay)
As always, I will greatly appreciate any knowledge and insights. Thanks, good monks.
Dec 02, 2025 at 03:05 UTC
A just machine to make big decisions
Programmed by fellows (and gals) with compassion and vision
We'll be clean when their work is done
We'll be eternally free yes, and eternally young Donald Fagen —> I.G.Y. (Slightly modified for inclusiveness)
Hi, I am currently using Filesys::SmbClient to access a text file but when using tcpdump I notice that the path etc are not encrypted. How do I force encryption?
I have set the following at: ~/.smb/smb.conf and /etc/samba/smb.conf
When I use /usr/bin/smbclient the stuff seems to be encrypted. However safely passing passwords to smbclient appears to be trickier and more troublesome.
However, when using DBI, the command errors out with this error info: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM articles_table' at line 1
If I put the articles table into double quotation marks, the error message is slightly different: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"articles_table"' at line 1
As said, the errors occur ONLY from DBI!
To make sure that there is no permissions problem etc, I even let DBI log on the MySQL server as root.
Any idea how to proceed when when things just look and work fine on the server console, but throw syntax errors when using DBI?
Edit:
Basically the code that fails is this:
my $my_articletable = 'articles_table';
my $p_db_art_id = 'db_art_id';
my $sqlcmd = "SELECT MAX($p_db_art_id) FROM $my_articletable;";
logit("SQLCMD: '$sqlcmd'");
my $sth = $p_dbh->prepare($sqlcmd);
$sth->execute();
As said, copypasting the resulting SQL command "SELECT MAX(db_art_id) FROM articles_table;" from the logfile into the MySQL monitor console does not give any hint what could be wrong, it just does what it is supposed to do.