Skip to main content





I'm experimenting with different frameworks and I've come across this wonderful catalyst framework based on Perl, does anyone know of a front end (which is website, forums, etc.) coupled with a back end (tracker engine) for use with modern Perl? I have a PHP based one and was wondering if it was possible to do the same using Perl.

submitted by /u/Otherwise-Tune-257
[link] [comments]



Asking for a friend. No really, I don't use VSCode but I know that a lot of people do and in one week I had two different people ask me this. I didn't see anything in the Visual Studio Marketplace. I'm looking for something like markdown-preview enhanced, but for Pod.

If you don't have that, is it something that you would want?

If it's something you want, would you throw in some money to have it? This isn't something I'd do myself, but I know some people with some free time who could use a little money. I could crowdfund it or whatever. The intent is to have something free in the Marketplace.

Would you care if it's not implemented in Perl? If it was JS or whatever VSCode prefers but does the job, that's fine with me (and remember I don't use VSCode). I have no idea how much that matters, but I'd hate for people to have to do all sorts of crazy setup, which for many people is installing anything from CPAN.

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



Function parameters of arrays sized m, n → m+n is the hello world of dependent types. I hacked this together over two evenings:
use 5.038; use strictures; use Kavorka qw(fun); use Moops; our %TypeVarRegistry; class MyTypes extends Type::Library :ro { use Type::Library -declare => qw(TypeVar TypeVarExpr); use Types::Common::String qw(NonEmptyStr); use Types::Standard qw(ArrayRef); use Types::Common::Numeric qw(PositiveOrZeroInt); my $TypeVar = Type::Tiny->new( name => 'TypeVar', constraint_generator => fun(NonEmptyStr $name → CodeRef) { fun {} } ); my $TypeVarExpr = Type::Tiny->new( name => 'TypeVarExpr', constraint_generator => fun(NonEmptyStr $name → CodeRef) { fun {} } ); my $SizedArray = Type::Tiny->new( name => 'SizedArray', parent => ArrayRef, constraint_generator => fun( Enum["type"] $literal_type, Type::Tiny $parameterized, Enum["length"] $literal_length, $expr → CodeRef ) { if (PositiveOrZeroInt->check($expr)) { fun { $expr == ArrayRef->of($parameterized)->assert_return($_)->@* } } elsif ('TypeVar' eq $expr->parent->name) { fun { $TypeVarRegistry{$expr->parameters->[0]} = ArrayRef->of($parameterized)->assert_return($_)->@*; 1 } } elsif ('TypeVarExpr' eq $expr->parent->name) { fun { my $eval; # world's worst symbolic expr parser if ( my ($var1, $op, $var2) = $expr->parameters->[0] =~ /(\w+)(\+)(\w+)/ ) { $eval = $TypeVarRegistry{$var1} + $TypeVarRegistry{$var2}; } else { die; } $eval == ArrayRef->of($parameterized)->assert_return($_)->@* } } else { die } }, ); __PACKAGE__->meta->add_type($_) for $TypeVar, $TypeVarExpr, $SizedArray; __PACKAGE__->meta->make_immutable; } use MyTypes qw(SizedArray TypeVar TypeVarExpr); fun add_ok( SizedArray[type => Str, length => TypeVar["m"]] $A, SizedArray[type => Str, length => TypeVar["n"]] $B → SizedArray[type => Str, length => TypeVarExpr["m+n"]] ) { [$A->@*, $B->@*] } use Data::Dx; Dx add_ok([qw(e r t)], [qw(e r t)]); fun add_broken( SizedArray[type => Str, length => TypeVar["m"]] $A, SizedArray[type => Str, length => TypeVar["n"]] $B → SizedArray[type => Str, length => TypeVarExpr["m+n"]] ) { [$A->@*, $B->@*, 'this must not work'] } use Data::Dx; Dx add_broken([qw(a s d f)], [qw(g h j k)]); 

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


I need to find the distance between two GPS coordinates. Geo::Calc does this effectively, but it hasn't been updated in over a decade, and, more seriously, it adds a significant startup delay just by loading the module:

root@1c8fb16bd7bb:/app# time perl -e 'use v5.38' real 0m0.005s user 0m0.001s sys 0m0.004s root@1c8fb16bd7bb:/app# time perl -e 'use v5.38; use Geo::Calc' real 0m0.679s user 0m0.631s sys 0m0.048s 

This isn't a deal-breaker (honestly, it barely matters at all in production, but it's annoying for repeated loads during dev/testing), but I was wondering if anyone knew of a more-modern/more-efficient alternative. I searched google and metacpan but it's tough to wade through the noise for such a generic search term.

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



The portions of B::Generate associated with PADOP construction use static variables, and thus are not thread safe.

This release imports that section of Generate.xs into sealed.xs and removes the static variable dependencies.

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



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



I am hopeful someone has done this before as I'm stuck... I have a 3TB disk image file and I am trying to find all the different email addresses that I've used over the past 22 years.

I can use hex editor tools to find them but it takes days to look at the data and pick out even a handful of matches.

I use Perl regularly but I normally scan text files and do non binary file actions. That's easy since I can do a line by line search. But binary seems different.

If I want to search for zeropoint@ (no domain because I've used dozens of ISPs over the years and that's why I am trying to figure this out.) inside the entire 3TB file, what's the best way to do that? I can dump the results to a file and then clean it up but the search part has me stuck

Thank you

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



submitted by /u/oalders
[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]



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]



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]






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]



Fast Perl SSG: now with automatic Language Translation via OCI and translate.pl. Check it out at

https://github.com/SunStarSys/orion

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



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


Im working on a script to test using a jump server to reach remote devices.

I'm able to connect to the jump server using Net::SSH::Expect, however, I'm not sure how to then ssh to a remote device (network element).

Is there a way to create that ssh to the remote device inside the jump server's connection?

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



First things first, I am a data engineer but have little experience in Perl. I've been able to make some easy updates to scripts in the past but this one is a bit tougher.

I have been asked to update a Perl cgi web app that someone wrote ages ago that is used to view and manipulate text files. Currently it is hosted on server (X) and manipulates the files on that same server. However, we have to have backups/mirrors of the data on a dev server and another prod sever (Y). I.e., if I push the button to move the file to a different folder, it should do that on all three servers instead of just X. I added code to do this, referencing the additional servers with their UNC names, but I just get an error "No such file or directory" (which is not true). Googling has suggested that there may be an issue with permissions, but I can bring up the Y and DEV servers from a windows file explorer using the same path so I don't think that is necessarily the issue.

Example: Here we are trying to copy the file with a letter appended a given number of times. It works fine on the X server, its when trying to make it also work on the Y and DEV servers I get an error.

our $DIR_X = "\\\\serverX\\folder\\subfolder" ; our $DIR_Y = "\\\\serverY\\folder\\subfolder"; our $DIR_DEV = "\\\\serverDEV\\folder\\subfolder"; . . . }elsif ($query->param('action') eq 'split' && $query->param('fileNum') ne "") { my $fileNum $query->param('fileNum'); my $fileX=$DIR_X . "\\" . $fileNum . ".txt"; my $fileY $DIR_Y . "\\" . $fileNum . ".txt"; my $fileDEV = $DIR_DEV . "\\" . $fileNum . ".txt"; my $splitNbr = $query->param('splitNbr'); my @letters1("a".. "z"); for (my $i = 0; $i < $splitNbr; $i++) { my $FileNew_X = $DIR_X . "\\" $fileNum. $letters[$i]=.txt"; my $FileNew_Y = $DIR_Y . "\\" $fileNum. $letters[$i]=.txt"; my $FileNew_DEV = $DIR_DEV . "\\" $fileNum. $letters[$i]=.txt"; copy($fileX, $FileNew_X) or die "WARNING: copy failed: $!\n"; ---->>>>>ERROR AT NEXT LINE copy($fileY, $FileNew_Y) or die "WARNING: copy failed: $!\n"; copy($fileDEV, $FileNew_DEV) or die "WARNING: copy failed: $!\n"; } 

Any thoughts?

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




I stumbled upon this really nice page from Ruby, describing the language from the perspective of other common programming languages:

https://www.ruby-lang.org/en/documentation/ruby-from-other-languages/

The page is written in a friendly tone, inviting programmers familiar with other programming languages to Ruby. No programming language is being viewed as inferior, quite the contrary: all mentioned languages are praised and even defended from haters, for example:

  • "Perl is awesome. Perl’s docs are awesome. The Perl community is … awesome. For those Perlers who long for elegant OO features built-in from the beginning, Ruby may be for you."
  • "Happily, it turns out that Ruby and C have a healthy symbiotic relationship. And, of course, Ruby itself is written in C."
  • "Java is mature. It’s tested. And it’s fast (contrary to what the anti-Java crowd may still claim)."
  • "Python is another very nice general purpose programming language."

I believe Perl could greatly benefit from having a similar page. With its friendly philosophy and TMTOWTDI, it seems natural to invite programmers from other languages, with an approach of "Don't be afraid to keep programming the way you are used to, if it works in Perl, there are no limits enforced".

Since Perl is now not a common choice for new code or for learning, it makes a lot of sense to bring over people from other languages. Especially in an age where strict conventions seem to be praised, I can see Perl becoming a source of some fresh air.

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



my $MAX_PROCESSES=10; my $pm = Parallel::ForkManager->new($MAX_PROCESSES); while (1) { my $pid=$pm->start and next; print "$$ LOCK \n"; $pm->finish; } $pm->wait_all_children; 

I made this sample piece of code which I basically took from the docs, I only changed to infinite loop but I cannot understand why this would make any different between an infinite loop and iterating through an array for example? Anyway I am fighting this for several hours now trying different versions of my code and cannot find why am I getting "Cannot start another process while you are in the child process" all the time, any hints appreciated

output looks basically like this

Cannot start another process while you are in the child process at .... 16366 LOCK 16367 LOCK 16368 LOCK 16369 LOCK 16370 LOCK 16371 LOCK 16372 LOCK 16373 LOCK 16374 LOCK 16375 LOCK Cannot start another process while you are in the child process at .... 

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



Purl: Streamlining Text Processing submitted by /u/tarje
[link] [comments]


The Joy of DTrace and ModPerl2 submitted by /u/joesuf4
[link] [comments]


Prior releases of the 6.x line relied on Lexical::Types, which was a major performance pessimisation over the 5.x releases.

6.0.4 relies on a simple source filter instead, which restores performance levels back to expected levels.

More benchmarks added to the test suite validate the dependency changes.

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



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


HTTP/2 Dynamic Benchmarks (PHP vs. ModPerl2), 2024 edition.

I ram these about four years ago, and the time differentials were about the same then as now. Monolithic POSIX-threaded server architectures like mp2 + mpm_event will always dominate in low-latency/scalability HTTP/2 benchmarks because they leverage zero-copy in the runtime.

Anyways, sexy terminal graphs with smag to enjoy!

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



Some basic stat computations with Perl , Python and RLessons learned:
A) Performance freaks to stop using #rstat 's runif for random generation. The Hoshiro random number generator https://arxiv.org/abs/1805.01407 is 10x faster.
Implementations in #perl 's #PDL, #rstats (dqrng) and #python #numpy are within 20% of each other

B) But does it make a difference in applications? To get to the bottom of this, I coded a truncated random variate generator in #rstats and #perl using #pdl (as well as standard u/perl) using the #GSL packages https://metacpan.org/pod/PDL::GSL::CDF & https://metacpan.org/pod/Math::GSL for accessing the CDF & quantile functions. In this context, it's the calculation of the #CDF that is the computationally intensive part, not the drawing of the random number itself.
Well even in these case, the choice of the generator did matter. Note that the fully vectorized #PDL #perl versions were faster than #rstats

C) I should probably blog about these experiments at some point. Note that #pdl (but not base #perl) are rather competitive choices for large array processing with numerical operations. I mostly stay away of #python , but would not surprise me that for compute intensive stuff (where the heavy duty work is done in C/C++), it does not matter (much) which high level language one uses to build data applications

https://preview.redd.it/qn00sx78gbuc1.png?width=1538&format=png&auto=webp&s=1874b9e710c239e9acea36fb54d957167a69b270

https://preview.redd.it/4by4jbh9gbuc1.png?width=1538&format=png&auto=webp&s=dc9944347983445126e4ab57b43c76202ca719d6

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

Programming Feed reshared this.



Hi, im working on this perl script wherein i should get all files with filename < 900000

Ex. sample_file_802856.txt sample_file_27364692.txt sample_file_385620.txt

the script should get:

sample_file_802856.txt sample_file_385620.txt

I already have the code but it’s failing on this part coz im having a hard time getting the regex for < 900000 😆

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



Hi,

I am moving to RedHat 9 from RedHat 7. I am running Apache with mod_perl.

I have installed the mod_perl package on the RedHat 9 box. I am getting this error on bit of code that I wrote:

Can't locate XSLoader.pm: /usr/local/lib64/perl5/5.32/XSLoader.pm: Permission denied at /usr/lib64/perl5/vendor_perl/Apache2/XSLoader.pm line 22.\nBEGIN failed--compilation aborted at /usr/lib64/perl5/vendor_perl/Apache2/XSLoader.pm line 22.\nCompilation failed in require at /usr/lib64/perl5/vendor_perl/Apache2/Access.pm line 24.\nBEGIN failed--compilation aborted at /usr/lib64/perl5/vendor_perl/Apache2/Access.pm line 24. 

When I do a search for XSLoader.pm, I find:
/usr/lib64/perl5/vendor_perl/APR/XSLoader.pm /usr/lib64/perl5/vendor_perl/Apache2/XSLoader.pm /usr/share/perl5/XSLoader.pm 

I am guessing I have some path issue. Any ideas what I may need to do?

thank you

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




I work in infosec, specifically in penetration testing. I learned Perl to some extent years ago when Metasploit was still written in Perl (They switched to Ruby). It seems these days that most people in my industry like Python, and some of the most important modules we use in my field are in Python. Does Perl offer any modules as comprehensive as Impacket for hacking protocols such as SMB, WMI, Kerberos, etc?

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



I think we need to create the next generation of Perl devs, because one day we’ll all be dead. What will Perl become if we don’t train as many people as we can?

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



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


Perl programming using KDE's Kate editor in Linux tutorial submitted by /u/nmariusp
[link] [comments]


A new release of PDL is out! It's been about a year since I last posted on here about a PDL release (last was PDL 2.083).

A selection of changes since PDL 2.083:

  • Diab Jerius reported that a previous change to [xyz]vals to return at least a double had a regression for code that requests an explicit type smaller than that. Fixed in 2.085.
    Diab Jerius also reported several other edge cases: 1, 2, 3 including a fix for vsearch.

    Also, Diab Jerius modularised the primitive ops tests which allows for faster parallel testing.

  • Harald Jörg reported that large arrays would cause PDL::FFT to crash. Fixed by switching from the stack VLAs to heap allocation. Fixed in 2.085.
    While it is recommended to use PDL::FFTW3 instead, PDL::FFT is bundled with PDL for the cases where PDL::FFTW3 can not be easily installed.
  • Bas Couwenberg reported and fixed a previously deprecated API in HDF4 which has now been removed and replaced. Fixed in 2.085.
    As part of the Debian release process, Bas Couwenberg reported a failure on i386. Fixed in 2.087.
  • Shawn Laffan provided an improvement to PDL::GIS::Proj so that it would load correctly on Windows via Alien::proj.
  • Po-Chuan Hsieh provided a build fix for FreeBSD on amd64. I also happened to talk to James E Keenan around the same time about PDL builds on FreeBSD so this was followed up by adding CI testing for FreeBSD. Fixed in 2.085.
  • Ryan Egesdahl provided a fix for macOS Ventura which changed the location of GLUT headers. Fixed in 2.085.
  • Eli Schwartz reported an upstream Gentoo bug when building with LTO that uncovered 64-bit issues in Minuit and Slatec Fortran code. Fixed in 2.086.
  • @vadim-160102 reported several issues with stringification: 1, 2; one of which uncovered a bug in conversion of ulonglong to Perl scalar.
  • Karl Glazebrook, @vadim-160102, and users from PerlMonks provided valuable reports in tracking down issues with dataflow https://github.com/PDLPorters/pdl/issues/461. Fix available in 2.086.
  • Jörg Sommrey contributed improved typemap handling which allows for using the typemap definitions that are available in Perl's default typemap. Available in 2.086.
  • Ed has added many improvements to the PP code generator and internal API as well as several new functions. Please see the Changes file for details!
    Of note are several speed improvements that are inspired by Eric Wheeler's note about the speed of sequence().

A full list of closed issues and PRs is here. Thanks to all the contributors!

There are also some things to report from the wider World of PDL:

  • Jörg Sommrey has released a PDL interface to GLPK (GNU Linear Programming Kit) for mathematical optimization: https://metacpan.org/pod/PDL::Opt::GLPK.
  • The PGPLOT distribution now incorporates PDL::Graphics::PGPLOT module that was in the PDL distribution. The dependencies remain the same.
  • PDL::Graphics::Simple had some small updates to the drivers. This is preparation for splitting the backend engines to their respective backend distributions (not yet released) and defining an API version that the engines conform to.

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



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