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 2025
Starts at: Jan 01, 2025 at 00:00
Ends at: Dec 31, 2025 at 23:59
Current Status: Active
4 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
A modernization of the canonical doc for learning XS
on Dec 22, 2025 at 13:52
0 replies by Intrepid

    A new version of the documentation for using xsubs in perl extension code is part of the Perl 5.43.6 devel-branch package.

    This is news from Reddit r/perl yesterday and also mentioned at TPF and I think it's significant enough to have a mention here at Perlmonks too.

    r/perl user Grinnz posted:

    David Mitchell completely rewrote the perlxs reference manual for the XS language for extending Perl in C. The rewritten version was just released in the development release 5.43.6 and will be included in the next stable release of Perl.

    I used pod2pdf to generate a PDF version of the document* once I'd built 5.43.6 (using perlbrew btw) and it's 77 pages in US-Letter size format. I didn't check for the length of the previous version of perlxs.pod but 77 pages is a small book; this is not a minor achievement but rather a significant contribution of the sort that does not always get the recognition and accolades it deserves.

    * I put it in my Google Drive, hopefully I've got the settings right so that you should be able to download it from there. sorry, Google Drive doesn't work that way. Or just run pod2pdf on the pod yourself, of course–it's not a difficult tool to use).

    Edit Again

    Should have listened to my first vague recollection of how Google Drive works. Yes, it can serve as a file-sharing system if the right settings are enabled. Now they are—now anyone with the URL should be able to view / download the PDF file in the link above.

    Dec 23, 2025 at 16:10 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)

Dotcom Survivor Syndrome – How Perl’s Early Success Created the Seeds of Its Downfall
on Dec 03, 2025 at 04:25
0 replies by mldvx4

    Dave Cross has posted Dotcom Survivor Syndrome – How Perl’s Early Success Created the Seeds of Its Downfall about current misconceptions about Perl and how those misconceptions came to be.

    Can We Move On?

    Dotcom Survivor Syndrome is real. So is Version Number Paralysis. Together, they’ve unfairly buried a language that remains fast, expressive, and battle-tested.

    We can’t change the past. But we can:

    • Acknowledge the emotional and historical baggage
    • Celebrate the role Perl played in inventing the modern web
    • Educate developers about what Perl really is today
    • Push back against the assumption that old == obsolete

    Certain vendors have certainly played the appeal to novelty fallacy to its outer limits to sell their own gimmicks while simultaneously maligning Perl. That'll take a lot to overcome, but is doable.

Supplications
GD module has no support for animated gifs
4 direct replies — Read more / Contribute
by Anonymous Monk
on Dec 22, 2025 at 23:59

    Hello perlmonks. I am hosting a website and for that purpose i want to make some animated gifs. I have downloaded the module GD but it gives the following error:

    libgd 2.0.33 or higher required for animated GIF support at C:\gd.pl line 7.

    I downloaded it again to make sure i have the right version, and i get the following message:

    GD is up to date. (2.83).

    It seems to me i have the right version but i am relatively new to perl. I have been looking on the internet but am unable to find an answer, therefore i seek your help. If you cannot help me i will have to find some other way to make some animated gifs. Thank you.

S-expressions with Marpa::R2: Grammar for Numbers
2 direct replies — Read more / Contribute
by karlgoethebier
on Dec 22, 2025 at 07:28

    I use this to process s-expressions with Marpa::R2:

    my $DSL = <<'DSL'; :default ::= action => ::first lexeme default = latm => 1 start ::= sexp sexp ::= list | atom list ::= LPAREN elements RPAREN action => Sexp::Tiny::Actions::do_list elements ::= element* action => Sexp::Tiny::Actions::do_elements element ::= sexp atom ::= string | symbol string ::= DQUOTE string_chars DQUOTE action => Sexp::Tiny::Actions::d +o_string | DQUOTE DQUOTE action => Sexp::Tiny::Actions::do_ +empty_string string_chars ::= string_char+ action => Sexp::Tiny::Actions::do_join string_char ::= STRCHAR DQUOTE ~ '"' STRCHAR ~ [^"] symbol ::= symbol_chars action => Sexp::Tiny::Actions::do_symbol symbol_chars ::= symbol_char+ action => Sexp::Tiny::Actions::do_join symbol_char ::= SYMCHAR SYMCHAR ~ [^()\s"] LPAREN ~ '(' RPAREN ~ ')' :discard ~ WS WS ~ [\s]+ DSL

    Probably awkward and there are certainly better ways, but it works: (i skip the processing part):

    karl@pazuzu:~/src/perl/debug/sexp-tiny$ bin/sexp.pl examples/fossil.da +t { fields => { "anonymous" => "off", "canonical-url" => "https://goethebier.space/fossi +l/p-acme", "crlf-glob" => "*.bat *.cmd", "crnl-glob" => "", "default-user" => "karl", "hash-policy" => "sha3", "http-port +" => 8081, "ignore-glob" => ["*.o", "*.swp", "*.tmp", ".dir +env/", "_build/", "_opam/"], "localauth" => "on", "max-upload" => "20MB", "project-d +escription" => "Private ACME tooling repository", "project-name" => "p-acme", "ssl-ca-location" => "/etc/ssl/certs", "throttle" => 0, "timeline-utc" => "on", }, type => "fossil", }

    But it only works for strings so far:

    karl@pazuzu:~/src/perl/debug/sexp-tiny$ echo '(acme (foo "bar"))' | bin/sexp.pl { fields => { foo => "bar" }, type => "acme" }

    But not with numbers:

    karl@pazuzu:~/src/perl/debug/sexp-tiny$ echo '(acme (x 1))' | bin/sexp +.pl bin/sexp.pl expected (key value...)

    I can only pass them in as string:

    karl@pazuzu:~/src/perl/debug/sexp-tiny$ echo '(acme (x "1"))' | bin/se +xp.pl { fields => { x => 1 }, type => "acme" }

    How must i modify the grammar to handle numbers (float and int)? I didn't find an example yet.

    Update:

    I'll try to illustrate how i did it:

    #!/usr/bin/env perl use strict; use warnings; use lib 'lib'; use Sexp::Tiny::Grammar (); use Data::Dump qw(dd); use Scalar::Util qw(blessed); my $src = q{(acme (pi "3.14")(nose "cuke"))}; dd $src; my $r = Sexp::Tiny::Grammar::build_reader(); dd ref($r); $r->read( \$src ); my $ast_ref = $r->value; dd $ast_ref; sub is_qstr { my ($v) = @_; return blessed($v) && $v->isa('Sexp::Tiny::String'); } sub unwrap_qstr { my ( $v, $path ) = @_; if ( is_qstr($v) ) { warn "[unwrap] $path: ", ref($v), qq{ -> plain perl string "}, $v->value, qq{"\n}; return $v->value; } return $v; } sub maybe_number { my ( $v, $path ) = @_; return $v if ref $v; if ( defined($v) && $v =~ /\A[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?\z/ ) { warn "[numify] $path: \"$v\" -> ", 0 + $v, "\n"; return 0 + $v; } return $v; } sub normalize { my ( $node, $path ) = @_; $node = unwrap_qstr( $node, $path ); if ( ref($node) eq 'ARRAY' ) { my @out; for my $i ( 0 .. $#$node ) { push @out, normalize( $node->[$i], "$path\[$i\]" ); } return \@out; } return maybe_number( $node, $path ); } my $norm = normalize( $$ast_ref, '$ast' ); dd $norm;

    Looks like it's doing what it's supposed to do:

    karl@pazuzu:~/src/perl/sexp-tiny$ leftovers/ex02.pl "(acme (pi \"3.14\")(nose \"cuke\"))" "Sexp::Tiny::Grammar::Reader" \[ "acme", ["pi", bless(do{\(my $o = 3.14)}, "Sexp::Tiny::String")], ["nose", bless(do{\(my $o = "cuke")}, "Sexp::Tiny::String")], ] [unwrap] $ast[1][1]: Sexp::Tiny::String -> plain perl string "3.14" [numify] $ast[1][1]: "3.14" -> 3.14 [unwrap] $ast[2][1]: Sexp::Tiny::String -> plain perl string "cuke" ["acme", ["pi", 3.14], ["nose", "cuke"]]

    my $src = q{(acme (pi 3.14)(nose "cuke"))}; works as well.

socket programming
2 direct replies — Read more / Contribute
by Anonymous Monk
on Dec 20, 2025 at 12:25

    I am doing a little bit of networking and i am trying to write a script that lets me communicate with servers. I was wondering if it's a good idea to use the module Net::Telnet instaed of working with sockets. If working with sockets directly is the way to go forward is it useful/better to use the built-in socket functions iso using the module IO::Socket::INET, or maybe it is more or less the same? I hope to hear from you, ty.

mtlsproxy feedback
1 direct reply — Read more / Contribute
by linuxlegends
on Dec 16, 2025 at 18:01

    I have this perl code this uses App::Spec and HTTP::Proxy to act as a forward proxy that handles mTLS requests - https://gitlab.com/infrastructure24/mitmtls/-/blob/main/src/mtlsproxy.sh?ref_type=heads. I'm planning on converting it to a CPAN module named App::Mtlsproxy since I was not able to find anything in CPAN that performs this task with a good CLI interface. The PAUSE documentation recommends posting here before uploading to get feedback. Does this seem like a good thing to upload to CPAN?

PerlMonks Discussions
A PM rewrite (proof of concept)
2 direct replies — Read more / Contribute
by Arunbear
on Dec 20, 2025 at 14:00