Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

The Monastery Gates

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

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

Quests
Wall of Larry Quest
Starts at: Feb 26, 2024 at 05:00
Ends at: Dec 31, 2024 at 04:59
Current Status: Active
2 replies by jdporter

    By now you've all seen The St. Larry Wall Shrine. Well, it could use a fresh coat of gold leaf and shellac. Therefore, we are soliciting Larry-related items to be placed on the shrine. Links to offsite content are good; or if you have small bits of content, such as quotes, you'd like to contribute, that's fine too. Please reply to this Quest with your humble offerings. Thank you! And may St. Larry bless your codings and your debuggings.

poll ideas quest 2024
Starts at: Jan 01, 2024 at 00:00
Ends at: Dec 31, 2024 at 23:59
Current Status: Active
2 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
List::Gen revivified
on May 17, 2024 at 16:02
1 reply by jo37

    After more than ten years of hibernation I was able to waken List::Gen and fix some tests that failed since v5.19 including "fails on bleadperl" and a reported bug "primes incorrect for 664580, and slow".

    The new version is currently available on my github repo only, as the author is not responding. Does anybody have information about "Eric Strom" aka "ASG"? Otherwise I might try to get an indexing permission on CPAN as a co-maintainer, though I'm clueless regarding this process.

    Greetings,
    🐻

    $gryYup$d0ylprbpriprrYpkJl2xyl~rzg??P~5lp2hyl0p$
Sponsorship Opportunities at the 2024 Perl and Raku conference
on May 16, 2024 at 20:39
0 replies by talexb

    The organizing committee for the Perl and Raku Conference 2024 is looking for a few more conference sponsors. If your organization uses Perl, now would be a great time to support the language. For more information, please visit this article on perl.com.

    The conference is only a little more than a month away! Get more information about the conference here.

    Alex / talexb / Toronto

    Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.

Supplications
Write to rsyslog
5 direct replies — Read more / Contribute
by slandry
on May 15, 2024 at 19:29
    I need to write very simple print statements to the rsyslog using perl. I can't use Log4perl.
    my $MYMESSAGE = "My string"; my $DATE=`date +%Y-%m-%dT%H:%M:%S%:z`; chomp $DATE; $LOG_HDR = "<14>1 $DATE localhost scrubdisk $$ scrubdisk - "; open (LOG, '>>', '/dev/tcp/localhost/601'); print LOG "$LOG_HDR $MYMESSAGE"; close (LOG);

    My header with the date/time stamps are all fine. My bash script works just fine with a simple echo statement, but perl does not. I have can not install any new perl modules. I would like to avoid writing 10+ lines of code to write a simple message to log file.
Tk install fails
2 direct replies — Read more / Contribute
by elef
on May 14, 2024 at 12:19
    Hi all, I have not had to mess with this stuff for a few years so bear with me... I'm trying to set up perl on my new computer and as usual, I'm getting indecipherable errors. Win11, StrawberryPerl 5.38.2.2. Open a cmd window, type cpan, type Install Tk... eventually I get:
    ../pTk/mTk/xlib/X11/X.h:182:34: error: expected identifier or '(' befo +re numeric constant 182 | #define ControlMask (1<<2) | ^ gmake[1]: *** [makefile:891: imgBMP.o] Error 1 gmake[1]: Leaving directory 'C:/STRAWB~1/cpan/build/Tk-804.036-1/pTk' gmake: *** [makefile:1638: pTk/libpTk.a] Error 2 SREZIC/Tk-804.036.tar.gz C:\STRAWB~1\c\bin\gmake.exe -- NOT OK Stopping: 'install' failed for 'Tk'. Failed during this command: SREZIC/Tk-804.036.tar.gz : make NO
    Halp!
Term::ReadLine handle wide character poorly
3 direct replies — Read more / Contribute
by vincentaxhe
on May 13, 2024 at 22:08

    I use Term::ReadLine, but It handle wide character(chinese) poorly, though the input is recognized correctly, is there a better module be able to deal wide character input, if just like type in a normal console

    state $term = Term::ReadLine->new('note'); my $prompt = "LINE:"; chomp($note = $term->readline($prompt)); $note = decode 'UTF-8', $note; $term->addhistory($note) if $note =~ /\S/;
PDL bitfield type - wanted?
1 direct reply — Read more / Contribute
by etj
on May 12, 2024 at 16:04
    I'm toying with the idea of adding a bitfield type to PDL, so that along the zeroth dimension it's not a whole number of bytes, but a calculated bit read (when it's used as an rvalue) or write (probably needs a function to set that, since PDL can't parse the C code yet to spot an lvalue).

    Feedback on whether that would be valuable enough welcome!

Meditations
Bizarre copy of ARRAY etc - solved
No replies — Read more | Post response
by etj
on May 13, 2024 at 17:07
    A simple XS function in PDL, firstvals_nophys, was giving "panic: attempt to copy freed scalar", but only if called on a complex-valued ndarray. The aim of this post is to appear when a despairing XS programmer googles that message, and give them another thing to check. When constructing a test to capture this, another message that appeared was "Bizarre copy of ARRAY". This is the old text of the function:
    void firstvals_nophys(x) pdl *x PPCODE: if (!(x->state & PDL_ALLOCATED)) barf("firstvals_nophys called on +non-ALLOCATED %p", x); PDL_Indx i, maxvals = PDLMIN(10, x->nvals); EXTEND(SP, maxvals); for(i=0; i<maxvals; i++) { PDL_Anyval anyval = pdl_get_offs(x, i); if (anyval.type < 0) barf("Error getting value, type=%d", anyval +.type); SV *sv = sv_newmortal(); ANYVAL_TO_SV(sv, anyval); PUSHs(sv); }
    The problem was that the ANYVAL_TO_SV macro was, only for complex-valued data, calling a Perl function to create a Math::Complex object (well, a subclass thereof because the overloads were wrong). That obviously uses the top of the stack, including writing values into it, and reading values out of it, including mortal ones that then got freed because they were done with. Therefore, the function was returning with some garbage on the stack, but the last value was correct.

    The solution was simply to do a PUTBACK after the PUSH, which moves the top of the stack above data we care about. The new text of the function with that:

    void firstvals_nophys(x) pdl *x PPCODE: if (!(x->state & PDL_ALLOCATED)) barf("firstvals_nophys called on +non-ALLOCATED %p", x); PDL_Indx i, maxvals = PDLMIN(10, x->nvals); EXTEND(SP, maxvals); for(i=0; i<maxvals; i++) { PDL_Anyval anyval = pdl_get_offs(x, i); if (anyval.type < 0) barf("Error getting value, type=%d", anyval +.type); SV *sv = sv_newmortal(); ANYVAL_TO_SV(sv, anyval); PUSHs(sv); PUTBACK; }
    The commit that fixed this is at https://github.com/PDLPorters/pdl/commit/68389413537c6ea7ed85f121a580b3b008ba82a6. The docs on how to call a Perl function from C are at https://perldoc.perl.org/perlcall, with a full explanation of PUSHMARK, PUSH*, PUTBACK, and (after the call) SPAGAIN, and maybe POP* and maybe then PUTBACK.
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 sharing their wisdom with the Monastery: (5)
As of 2024-05-18 22:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found