Skip to main content



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]




I've been trying to debug an issue for 3 days now, am getting nowhere, and am about to headbutt my laptop. If anyone's done any heavy lifting with Net:DBus then, for the sake of my laptop, I'd really appreciate the help!

Problem description: I have a hash table with a bunch of keys. The values relating to those keys are of different types (as in, I've cast them to dbus types). So:

my $testhash = {}; $testhash->{"xesam:albumArtist"} = [dbus_string("Tom Waits")]; $testhash->{"xesam:album"} = dbus_string("Mule Variations"); $testhash->{"xesam:trackNumber"} = dbus_int32(1); $testhash->{"xesam:artist"} = [dbus_string("Tom Waits")]; $testhash->{"xesam:title"} = dbus_string("Big in Japan"); $testhash->{"mpris:artUrl"} = dbus_string("file://mnt/storage/Music/mp3/Tom Waits/Mule Variations/folder.jpg"); $testhash->{"mpris:length"} = dbus_int64(64182857); $testhash->{"mpris:trackid"} = dbus_object_path("/0"); $testhash->{"xesam:url"} = dbus_string("file://mnt/storage/Music/mp3/Tom Waits/Mule Variations/01 - Big in Japan.mp3"); 

I've created a DBus service, and have successfully implemented a method that returns that hash table ($IFACE is the interface name I'm using for all of my test methods):
dbus_method("ReturnDynamicHash", [], [["dict", "string", ["variant"]]], $IFACE); sub ReturnDynamicHash { my $self = shift; print "Object: ReturnDynamicHash called.\n"; my $return = {}; my @keys = keys(%{$testhash}); my $count = scalar(@keys); if ($count) { foreach my $key (@keys) { $return->{$key} = $testhash->{$key}; } } return $return; } 

As a DBus method, this works perfectly:
% dbus-send ....... .ReturnDynamicHash array [ dict entry( xesam:trackNumber variant int32 1 ) dict entry( mpris:trackid variant /0 ) dict entry( xesam:albumArtist variant array [ Tom Waits ] ) dict entry( xesam:album variant Mule Variations ) dict entry( mpris:length variant int64 64182857 ) dict entry( xesam:url variant file://mnt/storage/Music/mp3/Tom Waits/Mule Variations/01 - Big in Japan.mp3 ) dict entry( mpris:artUrl variant file://mnt/storage/Music/mp3/Tom Waits/Mule Variations/folder.jpg ) dict entry( xesam:artist variant array [ Tom Waits ] ) dict entry( xesam:title variant Big in Japan ) ] 

However, the interface I'm implementing requires that a DBus Property return that hashtable, not a method:
dbus_property("StaticHashProperty", [["dict", "string", ["variant"]]], "read", $IFACE); sub StaticHashProperty { print "Object: StaticHashProperty accessed.\n"; my $return = {}; my @keys = keys(%{$testhash}); my $count = scalar(@keys); if ($count) { foreach my $key (@keys) { $return->{$key} = $testhash->{$key}; } } return $return; } 

and this doesn't work.

From the dbus-send client I get

Error org.freedesktop.DBus.Error.NoReply: Remote peer disconnected 

and from the Perl server stderr i get:
dbus[93409]: Array or variant type requires that type array be written, but object_path was written. The overall signature expected here was 'a{sas}' and we are on byte 4 of that signature. D-Bus not built with -rdynamic so unable to print a backtrace Aborted (core dumped) 

Now, this error is coming from libdbus itself, not the Perl wrapper (though could of course still be a bug in the Perl module that's causing the error). It seems to have entirely the wrong signature ( a{sas}, not a{sv} as defined above the Property method) and therefore appears to be complaining that the type of one of the values is wrong (each time I run it I get a slightly different error; I think it's deducing the signature from the first key-value pair it pulls from the hash and assumes they should all be the same - so if the first pair it pulls has a uint64 value, then it complains that the next pair doesn't also have a uint64 value).

Since the Method works I know Net::DBus can handle these sorts of return values, but for some reason, as a property, it just isn't working. I also know that other applications do implement this interface, including this Property, successfully, so I know this isn't a limitation of DBus.

I've been looking at the code in Net::DBus that handles serialization, assuming there must be some difference between how Properties and Methods are handled, but can't see anything obvious.

Anyone? Any idea? Literally anything at all? Thank you!!!!!

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









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






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


Although Benchmark::DKbench is a good overall indicator for generic CPU performance for comparing different systems (especially when it comes to Perl software), the best benchmark is always your own code. Hence, the module now lets you incorporate your own custom benchmarks. You can either have them run together with the default benchmarks, or run only your own set, just taking advantage of the framework (reports, multi-threading, monotonic precision timing, configurable repeats with averages/stdev, calculation of thread scaling etc). Here's an example where I run a couple of custom benchmarks on their own with Benchmark::DKbench:

``` use Benchmark::DKbench;

A simplistic benchmark sub:


sub str_bench { for (1..1000) { my $str = join("", map { chr(97 + rand(26)) } 1..rand(15000)); $str =~ s/a/bd/g; $str =~ tr/b/c/; } }

my %stats = suiterun({ include => 'custom', # Run only my custom benchmarks iter => 5, # Iterations to get an average extra_bench => { custom_bench1 => [&str_bench], # Add one more, just inline this time: custom_bench2 => [sub {my @a=split(//, 'x'x$) for 1..5000}], } }); ``` This will produce a report in STDOUT and also return the results in a hash for a single-thread run. You can also run the benchmarks multi-treaded and then calculate & print the multi/single-thread scalability:

```

If you want to get a count of logical cores:


my $cores = system_identity(1);

my %statsmulti = suite_run({ include => 'custom', threads => $cores, iter => 5, extra_bench => { custom_bench1 => [&str_bench], custom_bench2 => [sub {my @a=split(//, 'x'x$) for 1..5000}], } });

my %scal = calc_scalability(\%stats, \%stats_multi); ```

The report prints results per iteration and also aggregates:

``` Aggregates (5 iterations): Benchmark Avg Time (sec) Min Time (sec) Max Time (sec) custom_bench1: 1.092 1.079 1.107 custom_bench2: 0.972 0.961 0.983 Overall Avg Time (sec): 2.065 2.048 2.080

Aggregates (5 iterations, 10 threads): Benchmark Avg Time (sec) Min Time (sec) Max Time (sec) custom_bench1: 1.534 1.464 1.651 custom_bench2: 1.278 1.225 1.345 Overall Avg Time (sec): 2.812 2.689 2.965 The scalability report summarizes as well: Multi thread Scalability: Benchmark Multi perf xSingle Multi scalability % custom_bench1: 7.12 71

custom_bench2: 7.61 76


DKbench summary (2 benchmarks, 5 iterations, 10 threads): Single: 2.065s Multi: 2.812s Multi/Single perf: 7.36x (7.12 - 7.61) Multi scalability: 73.6% (71% - 76%) ```

The suite normally uses a scoring system which works better than times, so you can set that up by adding reference times to each benchmark, and you can also make the benchmarks return something (checksum etc) to verify results etc, see POD for more.

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



From the tprc-general Slack channel, Todd Rinaldo wrote yesterday that "Talk Accept, Decline, Waitlist emails have been sent out." See tprc.us for more information about this year's Perl and Raku Conference in Las Vegas, NV.

submitted by /u/talexbatreddit
[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.







Perl CPU Benchmark

Changes for 2.6 - 2024-04-25

  • Custom benchmark improvements.
  • Fix BSD tar xattr.


Code coverage metrics for Perl

Changes for 1.41

  • Spelling, linting and formatting changes



Experimental features made easy

Changes for 0.032 - 2024-04-25T22:30:41+01:00

  • Add the newly-stable features to stable.pm - extra_paired_delimiters, const_attr, for_list



Fetch actual raw streamable URLs from various radio-station, video & podcast websites.

Changes for 2.30 - 2024-04-25

  • StreamFinder::Castbox - Refactor to scrape episode data from the podcast page as now Castbox episode pages are no longer scrapable (now dynamically generated by javascript), but for now, all required episode data is embedded in the corresponding podcast page (for now). Also now append "lyrics" (transcript) to the "description" field (for Fauxdacious, etc.) for Castbox pages that provide this in a "lyrics" (.lrc) link!
  • StreamFinder::Google - REMOVED since Google has officially closed down it's podcast service.
  • StreamFinder::Podchaser - Fix failure to fetch episode data for the first episode (when a podcast page given) and failure to fetch all due to minor changes in their site.
  • StreamFinder::Spreaker - Refactor since Spreaker has now javascripted and cookied up their pages, but we're still able to scrape it's podcast pages for podcast metadata, required playlist data and 1st episode ID, and they provide a separate api site for fetching all episode data when given the episode-ID.
  • StreamFinder::Subsplash - Fix extraction of the artist & album fields due to minor changes in their site. Also add missing "Url" (first stream) field (not required for fetching streams).


OpenID Connect implementation integrated into Mojolicious

Changes for 0.01 - 2024-04-25T13:18:14-05:00

  • First public release



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 ...".





Read Perl’s symbol table programmatically

Changes for 0.11

  • (No code changes.)
  • Remove Travis CI.
  • Change README to Markdown.
  • Re-license under the MIT License.


Perl implementation for the Prague Markup Language (PML).

Changes for 2.25 - 2024-04-23T15:11:42Z

  • Fix saving relative paths to resource files.