send mail with STARTTLS
3 direct replies — Read more / Contribute
|
by Anonymous Monk
on Dec 15, 2025 at 00:57
|
|
|
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.
|
prove can't find my module, even though its directory is in $INC[0]
6 direct replies — Read more / Contribute
|
by HenryLaw
on Dec 14, 2025 at 17:57
|
|
|
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:
# echo $PERL5LIB
/home/henry/gitr/MAS/lib
# prove ./t/8bit.t
./t/8bit.t .. Can't locate MAS::Global in @INC (@INC entries checked:
+/home/henry/gitr/MAS/lib /etc/perl (... others omitted)
# find /home/henry/gitr/MAS/lib -name Global.pm
/home/henry/gitr/MAS/lib/MAS/Global.pm # It's in $INC[0]
# perl -c /home/henry/gitr/MAS/lib/MAS/Global.pm
/home/henry/gitr/MAS/lib/MAS/Global.pm syntax OK
Perl itself can find it:
# perldoc -l MAS::Global
/home/henry/gitr/MAS/lib/MAS/Global.pm
Compiler and OS details
# 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?
|
Faster (but uglier) PWC 350-2 solutions
2 direct replies — Read more / Contribute
|
by Anonymous Monk
on Dec 09, 2025 at 07:09
|
|
|
TASK2: https://theweeklychallenge.org/blog/perl-weekly-challenge-350/#TASK2
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:
sub pwc {
my ( $from, $to, $target ) = @_;
use integer;
my @witnesses = ([ 4, 7 ], [ 2 .. 9 ]);
my ( %pairs, $j );
for ( my $i = ( $from + 2 ) / 3 * 3; $i <= $to; $i += 3 ) {
my $i_key = join '', sort split '', $i;
my $k = $i % 9 ? 0 : 1;
for ( @{ $witnesses[ $k ]}) {
last if length( $j = $i * $_ ) != length( $i );
$pairs{ $i }{ $j } = $_
unless $i_key ne join '', sort split '', $j
}
for ( @{ $witnesses[ $k ]}) {
last if length( $j = $i / $_ ) != length( $i );
$pairs{ $i }{ $j } = -$_
unless $i % $_
|| exists $pairs{ $j } &&
exists $pairs{ $j }{ $i }
|| $i_key ne join '', sort split '', $j
}
}
return scalar grep { %$_ >= $target } values %pairs
}
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:
|
Perl::Critic versus File::Path
1 direct reply — Read more / Contribute
|
by mldvx4
on Dec 05, 2025 at 11:50
|
|
|
Greetings O monks,
I have turned perlcritic --stern towards several scripts I have and encountered a question. The manual page for File::Path contains the following excerpt:
@created = make_path('foo/bar/baz', '/zug/zwang', {
verbose => 1,
mode => 0711,
});
Indeed, in my script(s) that syntax works fine, like this for example make_path($page,{mode=>0775})
However, when I point perlcritic at the script(s), I get warnings like the following about how leading zeros should be avoided:
Integer with leading zeros: "0775" at line 657, column 34. See page 58 of PBP. (Severity: 5)
What is the right way to resolve that warning or error? Putting it in quotes does not have the desired effects.
PS. Any tips on non-Amazon book sellers inside the EU which can sell a paper copy of PBP?
|
Benchmarking Perl's Net::Async::FastCGI app consistently return LOTS of "Non-2xx responses"
3 direct replies — Read more / Contribute
|
by Anonymous Monk
on Dec 04, 2025 at 15:04
|
|
|
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/>
which returns:
...
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"
...
2. Nginx config:
==============================================================================
location /helloworld/ {
proxy_buffering off ;
gzip off ;
fastcgi_pass unix:/testFolder/myPath/myUDS.sock ;
include fastcgi_params ;
}
3. helloworld test script:
==============================================================================
|
Windows, SBP, 'File::Copy::Recursive::Reduced' fails its tests due to permissions
1 direct reply — Read more / Contribute
|
by Intrepid
on Dec 01, 2025 at 22:22
|
|
|
(SBP means "Strawberry Perl")
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)
I was not actually aiming to test or install File::Copy::Recursive::Reduced, but it was a dependency for Mouse.
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)
|
A Very Fast 64–Bit Date Algorithm
3 direct replies — Read more / Contribute
|
by mldvx4
on Nov 26, 2025 at 14:04
|
|
|
|
|
Normalizing diacritics in (regex) search
4 direct replies — Read more / Contribute
|
by LanX
on Nov 24, 2025 at 06:39
|
|
|
Hi
I have the problem to find multilingual filenames, where diacritics are inconsistently used. °
Of course I could do the normalization manually and map à á ä å ... -> a and so on.
But I suppose that
- I'm reinventing the wheel
- there is consistent unicode attribute for this.¹
- or a cpan module
I already looked at the regex modifiers but couldn't find any "diacritics independent" similar to /i
(The only remote possibility which comes to mind is a special locale doing the trick ...hmm)
Thanks in advance!
UPDATES
°) Latin alphabet only in my case!
¹) compare Based on "a" (U+0061)
|
Forcing encryption for Filesys::SmbClient or alternatives?
No replies — Read more | Post response
|
by Anonymous Monk
on Nov 24, 2025 at 04:55
|
|
|
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
[global]
client min protocol = SMB3
client smb encrypt = required
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.
|
[SOLVED] Need advice how to diagnose the problem when syntax using MAX() is correct according to MySQL monitor, but errors out in DBI
8 direct replies — Read more / Contribute
|
by dissident
on Nov 21, 2025 at 10:03
|
|
|
There is a simple database.
root@localhost [project_db]> describe articles_table;
+------------------------+--------------+------+-----+---------+------
+-+
| Field | Type | Null | Key | Default | Extra
+ |
+------------------------+--------------+------+-----+---------+------
+-+
| db_art_id | bigint | YES | MUL | NULL |
+ |
I need the highest article ID in the column "db_art_id".
This works just fine from the console:
root@localhost [project_db]> SELECT MAX(db_art_id) FROM articles_table
+;
[...]
+----------------+
| MAX(db_art_id) |
+----------------+
| 1 |
+----------------+
1 row in set (0.01 sec)
root@localhost [project_db]>
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.
|