Skip to main content



You may have noticed the slow pace of Corinna development. As it turns out, there's an easy way to speed up the development: tell Paul.

I had a call with Paul "LeoNerd" Evans last night and this, including his email address, is being shared with his permission.

As you might imagine, being a core Perl developer, Paul has many things on his plate. Currently has has tons of PRs against the Perl core, he's doing new work such as experimenting with data checks (don't call them "types"!), and is active on the Perl steering council and in P5P. However, he's previously mentioned that he doesn't get much feedback on his work. For adding something as important as Corinna, just blindly adding it without hearing from the community is bad. Yes, we had a multi-year design phase and Corinna is much better for it, but that doesn't mean it's perfect and we don't want to screw this up.

So here's where you come in. Email Paul at leonerd at leonerd.org.uk. Tell him your thoughts about Corinna. He's he one implementing it and working in isolation as he is, despite his work with Object::Pad, isn't good. Tell him what you like, what you don't like, what you'd like to see next, what bugs you've encountered, and so on. Without hearing from you, he has no way of judging community thoughts/support for this project, so he needs your help.

If you'd like a quick refresher on the new syntax, I've written a short introduction. Here's a dead-simple LRU cache written in the new syntax:

use feature 'class'; class Cache::LRU { use Hash::Ordered; field $cache = Hash::Ordered->new; field $max_size :param :reader = 20; method set( $key, $value ) { $cache->unshift( $key, $value ); # new values in front if ( $cache->keys > $max_size ) { $cache->pop; } } method get($key) { return unless $cache->exists($key); my $value = $cache->get($key); $cache->unshift( $key, $value ); # put it at the front return $value; } } 

submitted by /u/OvidPerl
[link] [comments]




My job has led me down the rabbit hole of doing some scripting work in Perl, mainly utility tools. The challenge being that these tools need to parse several thousand source files, and doing so would take quite some time.

I initially dabbled in doing very light stuff with a perl -e one-liner from within a shell script, which meant I could use xargs. However, as my parsing needs evolved on the Perl side of things, I ended up switching to an actual Perl file, which hindered my ability to do parallel processing as our VMs did not have the Perl interpreter built with threads support. In addition, installation of any non-builtin modules such as CPAN was not possible on my target system, so I had limited possibilities, some of which I would assume to be safer and/or less quirky than this.

So then I came up with a rather ugly solution which involved invoking xargs via backticks, which then called a perl one-liner (again) for doing the more computation-heavy parts, xargs splitting the array to process into argument batches for each mini-program to process. It looked like this thus far:

my $out = `echo "$str_in" | xargs -P $num_threads -n $chunk_size perl -e ' my \@args = \@ARGV; foreach my \$arg (\@args) { for my \$idx (1 .. 100000) { my \$var = \$idx; } print "\$arg\n"; } '`; 

However, this had some drawbacks:
  • No editor syntax highlighting (in my case, VSCode), since the inline program is a string.
  • All variables within the inline program had to be escaped so as not to be interpolated themselves, which hindered readability quite a bit.
  • Every time you would want to use this technique in different parts of the code, you'd have to copy-paste the entire shell command together with the mini-program, even if that very logic was somewhere else in your code.

After some playing around, I've come to a nifty almost-metaprogramming solution, which isn't perfect still, but fits my needs decently well:

sub processing_fct { my u/args = u/ARGV; foreach my $arg (@args) { for my $idx (1 .. 100000) { my $var = $idx; } print "A very extraordinarily long string that contains $arg words and beyond\n"; } } sub parallel_invoke { use POSIX qw{ceil}; my $src_file = $0; my $fct_name = shift; my $input_arg_array = shift; my $n_threads = shift; my $str_in = join("\n", @{$input_arg_array}); my $chunk_size = ceil(@{$input_arg_array} / $n_threads); open(my $src_fh, "<", $src_file) or die("parallel_invoke(): Unable to open source file"); my $src_content = do { local $/; <$src_fh> }; my $fct_body = ($src_content =~ /sub\s+$fct_name\s*({((?:[^}{]*(?1)?)*+)})/m)[1] or die("Unable to find function $fct_name in source file"); return `echo '$str_in' | xargs -P $n_threads -n $chunk_size perl -e '$fct_body'`; } my $out = parallel_invoke("processing_fct", \@array, $num_threads); 

All parallel_invoke() does is open it's own source file, finds the subroutine declaration, and then passes the function body captured by the regex (which isn't too pretty, but it was necessary to reliably match a balanced construct of nested brackets) - to the xargs perl call.

My limited benchmarking has found this to be as fast if not faster than the perl-with-threads equivalent, in addition to circumventing the performance penalty for the thread safety.

I'd be curious to hear of your opinion of such method, or if you've solved a similar issue differently.

submitted by /u/Wynaan
[link] [comments]



List of new CPAN distributions – Jun 2024 submitted by /u/perlancar
[link] [comments]


Hey, I have a chance at getting an interview for a position through a connection (internship), and the position I was referred to said the job would mainly focus on PERL, how could I get ready for this interview? On my resume, I want to add a small portion where I say I'm developing my PERL skills. I saw some basic tutorials for making simple calculators and whatnot. What could I do to get ready and impress my interviewers? Also, should I add these simple projects like a calculator on my Git Hub just to show I have at least a little experience? If not, what other projects could I work on to develop my skills with PERL, I'd love any advice I could get, thanks!

Some background: I've only done Python and Java through my university and did a bit of webdev in my free time.

submitted by /u/SquareRaspberry3808
[link] [comments]



Vim highlights subs with a signature params as red/orange to alert you it's incorrect. Now that Perl actually supports signatures and this is no longer a syntax error I need to find a way to disable this. This is really a Vim question, but I'm sure some other Perl nerd out there has run into this before me.

Has anyone figured out how to disable this "warning" in Vim?

submitted by /u/scottchiefbaker
[link] [comments]



A quick demo I threw togetherI threw together a quick proof of concept for myself writing out a very simple Entity Component System (ECS) and implementing the flocking simulation on top of it. I liked how it came together so well I wrote some prose around it and decided to share.

Note: this is using features from the soon-to-be-released 5.40.0 (RC1 dropped last Friday).

submitted by /u/perigrin
[link] [comments]



submitted by /u/niceperl
[link] [comments]


Hi, I recently got an offer for Senior SWE (current title at my company now) for a company that heavily utilizes Perl. I was wondering if folks from this community could offer some insight on what it's like working with Perl and also what, if any, potential long-term career implications are of becoming a Perl developer? Particularly I'm worried of pigeon-holing myself since Perl is not as heavily used in todays age and this company does not make use of modern cloud tools and deployments.

I am a Java developer (5 YOE) at a enterprise software company that is deployed in GCP. We are pretty regularly adopting new technologies so I'm gaining some valuable and relevant industry experience here but I am looking for a change and more opportunity to lead projects and mentor junior engineers.

The company seems good, great WLB, I liked the manager, and with the bonus (base is roughly the same) it would be about a ~8% TC increase plus a lot more stock (monopoly money, private RSUs).

Does anyone have experience transitioning from a Perl based company to a cloud based company with a more modern tech stack? Is this a backwards direction for me, should I continue with my Java development and instead look for opportunities that will offer more marketable skills?

Any input is appreciated, thank you for reading.

submitted by /u/Roodiestue
[link] [comments]



Mo utilities for email.

Changes for 0.02 - 2024-04-26T23:02:53+02:00

  • Add tests for error parameters.
  • Rewrite the tests so that the functional tests are first and then the errors.







Read lines from STDIN.

Changes for 0.557 - 2024-04-26

  • readline: removed broken 'history' behaviour.



Perl extension for finding the memory usage of Perl variables

Changes for 0.84 - 2023-04-25

  • no changes



Hi! Asking for a wisdom here...

We have a module that modifies signal handler $SIG{__DIE__} to log information and to die afterwards. Hundreds of scripts relied on this module which worked fine in perl 5.10.1.

Recently we had the opportunity to install several Perl versions but unfortunately a large number of scripts that used to work with Perl 5.10.1 now behave differently:

  • Failed in 5.14.4: /home/dev/perl-5.14.4/bin/perl -wc test.pl RECEIVED SIGNAL - S_IFFIFO is not a valid Fcntl macro at /home/dev/perl-5.14.4/lib/5.14.4/File/stat.pm line 41
  • Worked without changes in 5.26.3: /home/dev/perl-5.26.3/bin/perl -wc test.pl test.pl syntax OK
  • Worked without changes in 5.38.2: /home/dev/perl-5.38.2/bin/perl -wc test.pl test.pl syntax OK

Many of the scripts can only be updated to 5.14.4 due to the huge jumps between 5.10 and 3.58; But we are stuck on that failures.

Was there an internal Perl change in 5.14 which cause the failures but works on other recent versions without any update on the scripts?

Cheerio!

submitted by /u/Longjumping_Army_525
[link] [comments]



Sanity-check calling context

Changes for 0.04

  • (no code changes)
  • Switched to MIT license.
  • Switched README from POD to Markdown.
  • Removed Travis CI.



Sort lines of text by a Comparer module

Changes for 0.002 - 2024-03-07

  • No functional changes.
  • [doc] Mention some related links.


An assortment of date-/time-related CLI utilities

Changes for 0.128 - 2024-03-07

  • [clis strftime, strftimeq] Use localtime() instead of gmtime(). We can still show UTC using "TZ=UTC strftime ...".



I understand that many disagree with this statement, but it really makes it easier to build distributions for people who not monks. Wish the documentation was more detailed

submitted by /u/ReplacementSlight413
[link] [comments]



Sah schemas related to BCA (Bank Central Asia) bank

Changes for 0.002 - 2024-04-03

  • Rename module/dist Sah-Schema{s,Bundle}-* following rename of Sah-Schema{s,Bundle} (for visual clarity and consistency with naming of other bundles).



search nested hashref/arrayref structures using JSONPath

Changes for 1.0.5 - 2024-04-22T16:10:46-05:00



simulating paper and pencil techniques for basic arithmetic operations

Changes for 0.01 - 2024-04

  • First version, with the four basic operations, plus square-root, GCD and radix conversion. And HTML rendering


Use a type to validate values in a deep comparison.

Changes for 1.0.1 - 2024-04-22

  • Add Test2::Tools::Type





An open source web-based network management tool.

Changes for 2.076000 - 2024-04-22

  • NEW FEATURES
  • ENHANCEMENTS
  • BUG FIXES


Silverpeak Orchestrator REST API client library

Changes for 0.011000 - 2024-04-22T17:58:39+02:00

  • add support for version 9.3+ API endpoints


A module that performs semantic similarity in PXF/BFF data structures and beyond (JSON|YAML)

Changes for 0.07 - 2024-04-22T00:00:00Z

  • Excluded keys with {} or [] values (e.g. subject.vitalStatus: {})
  • Precompiled regex patterns where possible
  • Schema validation errors related to weights are now directed to STDERR
  • Added support for variables with non-word characters (e.g., "Survey.Timestamp.1")



Pango style markup formatting

Changes for 0.036 - 2024-04-22

  • Introducing struts. Update SYNOPOSIS example to modern PDF::API2 conventions. Fix/enhance drawing of brackgrounds. Fix problem with wrongly calculated underlining.


My environment is perl/5.18.2 on CentOs 7

I'm trying to use a SWIG generated module in perl, which has a c plus plus backend. The backend.cpp sets an environment variable, $MY_ENV_VAR =1

But when I try to access this in perl, using $ENV{MY_ENV_VAR} this is undef.

However doing something like print echo $MY_ENV_VAR works

So the variable is set in the process, but it's not reflected automatically since nothing updates the $ENV data structure.

I'm assuming it may work using some getEnv like mechanism, but is there a way to reset/ refresh the $ENV that it rebuilds itself from the current environment?

submitted by /u/sarcasmwala
[link] [comments]



By default cpanm drops Perl modules into ~/perl5. How do I tell cpanm to use a different location, such as ~/.local/share/perl5 instead?

submitted by /u/s-ro_mojosa
[link] [comments]



Get stock and mutual fund quotes from various exchanges

Changes for 1.61_01 - 2024-04-21T17:50:16-07:00

  • YahooWeb.pm - Issue #377. Modified YahooWeb to account for changes from Yahoo.
#377


Sah schemas related to SortKey

Changes for 0.002 - 2024-03-07

  • Rename module/dist Sah-Schema{s,Bundle}-SortKey.


Perl Data Language

Changes for 2.088 - 2024-04-22

  • Slatec::ch{ic,sp} work arrays now [t]
  • add Slatec::bvalu
  • add Func::{pchip,spline}, and a demo
  • add Ufunc::diff2
  • extra ) on end of Pars now an error
  • PP dim sizes can be =CALC(...) instead of explicit RedoDimsCode
  • PP add loop(n=start:end:inc) idiom to stop not at end and have non-1 inc
  • updated README.md - thanks @falsifian
  • support T_PTROBJ in typemap