Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

The Monastery Gates

( [id://131]=superdoc: print w/replies, xml ) Need Help??

New here?I want to ask a question of the Perl Monks. Where do I start?

Notices:

hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.

If you're new here, please read PerlMonks FAQ
and Create a new user!

Quests
poll ideas quest 2026
Starts at: Jan 01, 2026 at 00:00
Ends at: Dec 31, 2026 at 23:59
Current Status: Active
0 replies by pollsters
    First, read How do I create a Poll?. Then suggest your poll here. Complete ideas are more likely to be used.

    Note that links may be used in choices but not in the title.

Perl News
Andrew Shitov announces Raku++, a new compiler for Raku
on Jul 14, 2026 at 10:34
1 reply by jdporter

    Andrew Shitov has announced his Raku++ compiler.

    Some highlights:

    • a new from-scratch implementation of Raku, written in C++
    • it's fast
    • there are interpreter and compiler modes. The latter can generate native code, with optional optimization.
    • it's passing 82% of roast (the official test suite for Raku)
    • binaries are available for macOS, Linux, and Windows

    (shortcut to the documentation)

Call for Participation - Summer Perl Community Conference July 3-4
on Jun 17, 2026 at 01:02
0 replies by oodler
Supplications
freebsd -Dusequadmath builds of perl
1 direct reply — Read more / Contribute
by syphilis
on Jul 14, 2026 at 23:36
    Hi,

    I've just hacked up a -Dusequadmath build of perl-5.44.0-RC2 on freebsd-15.1, using the gcc compiler.
    The same should be achievable using the clang compiler, and I'll get to doing that - but there might be some additional hoops to jump through.

    The question that has been bugging me for a while is "why do most builders of perl on freebsd choose clang over gcc as the compiler ?"
    I assume there is some rationality involved, but it's not evident to me.

    I don't think there's much interest here in quadmath builds but, for anyone interested, here is the hack:
    It is necessary to firstly hack ext/POSIX/POSIX.xs
    $ diff -u POSIX.xs_orig POSIX.xs --- POSIX.xs_orig 2026-07-15 11:31:26.616152200 +1000 +++ POSIX.xs 2026-07-15 21:19:36.225074300 +1000 @@ -467,14 +467,14 @@ #endif /* Check both the Configure symbol and the macro-ness (like C99 promi +ses). */ -#if defined(HAS_FPCLASSIFY) && defined(fpclassify) +#if defined(HAS_FPCLASSIFY) && defined(fpclassify) && !defined(__Free +BSD__) # define c99_fpclassify fpclassify #endif /* Like isnormal(), the isfinite(), isinf(), and isnan() are also C99 and also (sizeof-arg-aware) macros, but they are already well take +n care of by Configure et al, and defined in perl.h as Perl_isfinite(), Perl_isinf(), and Perl_isnan(). */ -#ifdef isnormal +#if defined(isnormal) && !defined(__FreeBSD__) # define c99_isnormal isnormal #endif #ifdef isgreater /* canary for all the C99 is*<cmp>* macros. */
    Then perl built without any issues with:
    sh Configure -des -Dcc=gcc -Accflags=-I/usr/local/lib/gcc14/gcc/x86_64 +-portbld-freebsd15.0/14.2.0/include -Alibpth=/usr/local/lib/gcc14 -Al +ddlflags=-L/usr/local/lib/gcc14 -Dprefix=/home/sis/perl-5.44.0-RC2-gc +c-q -Dusequadmath && make && make test
    All tests passed.
    without the -A.... flags, lib/ExtUtils/t/Embed.t failed one of its tests because quadmath functions were not being resolved.
    Those same flags will be needed by some other CPAN modules.

    I'll update this post with the requisite Configure command, once I've established what it is.

    Is that hack to POSIX.xs acceptable as is ?
    I feel that it's okay - though it probably should be extended to cover other BSD systems. (I've no way of testing that.)

    UPDATE:

    For the clang -Dusequadmath build I've used pretty much the same as for the gcc build - but I've removed the -Dcc=gcc Configure arg, and added -Aldflags=-L/usr/local/lib/gcc14 (without which Configure could not locate the quadmath library):
    sh Configure -des -Accflags=-I/usr/local/lib/gcc14/gcc/x86_64-portbld- +freebsd15.0/14.2.0/include -Alibpth=/usr/local/lib/gcc14 -Alddlflags= +-L/usr/local/lib/gcc14 -Dprefix=/home/sis/perl-5.44.0-RC2-clang-q -Du +sequadmath -Aldflags=-L/usr/local/lib/gcc14 && make && make test
    This time, however, one test script (ext/POSIX/t/fenv.t fails the FLT_ROUNDS tests), though all of the very same tests passed on the gcc build :
    $ perl ext/POSIX/t/fenv.t ok 1 - fegetround ok 2 - FLT_ROUNDS ok 3 - fesetround ok 4 - fesetround/fegetround round-trip ok 5 - fesetround(FE_TOWARDZERO) ok 6 - fegetround() under FE_TOWARDZERO not ok 7 - FLT_ROUNDS under FE_TOWARDZERO # Failed test 'FLT_ROUNDS under FE_TOWARDZERO' # at ext/POSIX/t/fenv.t line 41. # got: 1 # expected: 0 ok 8 - fesetround(FE_TONEAREST) ok 9 - fegetround() under FE_TONEAREST ok 10 - FLT_ROUNDS under FE_TONEAREST ok 11 - fesetround(FE_UPWARD) ok 12 - fegetround() under FE_UPWARD not ok 13 - FLT_ROUNDS under FE_UPWARD # Failed test 'FLT_ROUNDS under FE_UPWARD' # at ext/POSIX/t/fenv.t line 41. # got: 1 # expected: 2 ok 14 - fesetround(FE_DOWNWARD) ok 15 - fegetround() under FE_DOWNWARD not ok 16 - FLT_ROUNDS under FE_DOWNWARD # Failed test 'FLT_ROUNDS under FE_DOWNWARD' # at ext/POSIX/t/fenv.t line 41. # got: 1 # expected: 3 1..16 # Looks like you failed 3 tests of 16.
    My immediate conclusion is to blame this on "clang recalcitrance", but I should probably also consider other possibilities ;-)

    UPDATE 2:

    I was able to work around the ext/POSIX/t/fenv.t test failures on the clang quadmath build by a small hack to POSIX.xs
    The diff on that file has now become:
    $ diff -u POSIX.xs_orig POSIX.xs --- POSIX.xs_orig 2026-07-15 11:31:26.616152200 +1000 +++ POSIX.xs 2026-07-15 21:19:36.225074300 +1000 @@ -46,7 +46,11 @@ #ifdef WIN32 #include <sys/errno2.h> #endif -#include <float.h> +#if defined(__clang__) && defined(__FreeBSD__) && defined(USE_QUADMAT +H) +# include <x86/float.h> /* load the correct float.h */ +#else +# include <float.h> +#endif #ifdef I_FENV #if !(defined(__vax__) && defined(__NetBSD__)) #include <fenv.h> @@ -467,14 +471,14 @@ #endif /* Check both the Configure symbol and the macro-ness (like C99 promi +ses). */ -#if defined(HAS_FPCLASSIFY) && defined(fpclassify) +#if defined(HAS_FPCLASSIFY) && defined(fpclassify) && !defined(__Free +BSD__) # define c99_fpclassify fpclassify #endif /* Like isnormal(), the isfinite(), isinf(), and isnan() are also C99 and also (sizeof-arg-aware) macros, but they are already well take +n care of by Configure et al, and defined in perl.h as Perl_isfinite(), Perl_isinf(), and Perl_isnan(). */ -#ifdef isnormal +#if defined(isnormal) && !defined(__FreeBSD__) # define c99_isnormal isnormal #endif #ifdef isgreater /* canary for all the C99 is*<cmp>* macros. */ #ifdef isgreater /* canary for all the C99 is*<cmp>* macros. */
    I suspect that at least some of the hacking I've done could better be replaced with some astute alterations to the Configure script and/or the hints file.
    Advice on that aspect would be most welcome.

    Cheers,
    Rob
Meditations
Best Practices that you Love
3 direct replies — Read more / Contribute
by starX
on Jul 14, 2026 at 11:37
    In the spirit of TMTOWTDI, I fully recognize that not all "best practices" are the best fit for all situations, but a recent meditation has me thinking about some of the best practices that I use, not just in perl, but across my coding. Many of them I can trace to Perl Best Practices. I'm wondering, though, what are some best practices that you have adopted that make your code better, your work better, or your documentation better? By "better" I mean not only more optimized, but also more legible, more maintainable, anything that you might look at and say a thank you to your past self for taking the time to do?

    For me, I had a professor drill into me that I should always write the comments first to make sure I understood what I was setting out to do; including examples of how I would call the function or execute the application. And especially as I have used libraries I am less familiar with, I find that is really useful for both figuring out what I'm trying to do, and explaining to my future self what I was trying to do when I first wrote the code. It does result in code that is more verbose than it needs to be, but on the whole, I don't think I've ever been sad to have more documentation than less when I've been trying to figure something out.

    I'd love to hear some of the best practices that you all find indispensable, or even just merely helpful, to your work.

Cool Uses for Perl
Gyro + Accelerometer
1 direct reply — Read more / Contribute
by stevieb
on Jul 13, 2026 at 02:43

    Almost done my code for the MPU-6050 gyro/accelerometer. Backed by my C/XS SMBus code (in RPi::I2C), it's pretty effective. One of the last pieces of my overall RPi::WiringPi hardware test platform will be a little two-wheeled robot that can stand and stabilize itself, and this will be a core piece of that.

    I have two more distributions to finish (A4988 stepper motor controller, and a doppler radar motion sensor RCWL-0516), create the PCBs, and I'm on my way. My test platform (to test all of the devices I've written software for) will now consist of six custom PCBs (four of which are done, two received, two in transit, one in PCB finalization phase, the other still in the schematic layout phase).

    Saw it was a slow night here on PM, so I thought I'd express how although I kind of backed off of Perl for a while in regards to my Open Source stuff, I'm once again totally feeling the love.

    MPU6050 + OLED 128x64

    -stevieb

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2026-07-16 11:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.