I forgot it was CPAN Day, but it still is CPAN Day in parts of the world so maybe you can get some CPAN housecleaning in. I use this day to delete old versions of my distributions from CPAN.
submitted by /u/briandfoy
[link] [comments]
submitted by /u/briandfoy [link] [comments] |
- YouTube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.www.youtube.com
I found a script from 2008 year, that renames files to random filenames:
```
!/usr/bin/perl
randomize the filenames for the photo frame
https://www.bulkrenameutility.co.uk/forum/viewtopic.php?t=114
$dir = $ARGV[0] || die "directory?\n"; chdir($dir) || die "chdir";
opendir(D, ".") || die "opendir"; @files = grep {/jpg/} readdir(D); closedir(D);
array shuffle from perl FAQ
srand; @newfiles = (); for (@files) { my $r = rand @newfiles + 1; push(@newfiles,$newfiles[$r]); $newfiles[$r] = $_; }
if ($#files != $#newfiles) { die "$#files != $#newfiles\n"; }
while ($old = pop @files) { $new = pop @newfiles; $new =~ s/p/r/; ! -f $new || die "won't overwrite $new - check the regexp\n"; print "$old -> $new\n"; rename $old, $new || warn "rename $old -> $new: $!\n"; } ```
If I run it as perl foo.pl ./
, there is won't overwrite bar.jpg - check the regexp
error. And if I run it as perl fo.pl ./bar.jpg
, there is chdir at foo.pl line 7
error. How to make it work?
I have Perl 5.34.1 installed.
submitted by /u/Impressive-West-5839
[link] [comments]
Abe Timmerman ABELTJE has passed away yesterday after a long fight with cancer.
A long time participant in what are now called Perl Toolchain Summits, he was co-responsible for setting up the Perl smoking infrastructure.
And was always a welcome guest at almost all YAPC::EU conferences, as well as many Dutch and Belgian Perl Workshops, and NLPM (Dutch PerlMongers) meetings.
He will be missed. R.I.P.
submitted by /u/liztormato
[link] [comments]
[link] [comments]
The Day Perl Stood Still: Unveiling A Hidden Power Over C
Sometimes the unexpected happens and must be shared with the world … this one is such a case.Killing-It-with-PERL
As a security engineer I am obsessed with building computer systems that are reliable and fault-tolerant. I was researching Erlang and Elixir to build servers that are designed that way. But others here mentioned Perl is used in production ready projects where availability of the system is key -- such as Amazon.
What are the pros and cons in using Perl to deploy production ready servers vs Erlang, Elixir, Golang, C++ and other common back end languages / frameworks?
submitted by /u/fosres
[link] [comments]
Aside from the Perl project itself what were the Perl projects published that had a positive impact in the world--whether in the tech industry or even for hackers and hobbyists. I ask to better understand what Perl is and is not useful for.
submitted by /u/fosres
[link] [comments]
So I came across a book named "Higher-Order Perl" which teaches how to apply functional coding concepts to complete tasks in Perl. Have you used the book's techniques in your production-deployed projects? If so how did the book's advice help?
submitted by /u/fosres
[link] [comments]
Hi everyone. I am still researching how to benefit from Perl as a security engineer. I heard you can use Perl to test for security exploits in codebases? What have you used Perl for in he past? What did you find of most helpful for in your coding journey?
submitted by /u/fosres
[link] [comments]
[aside] This is not a cross-post. Few days ago I asked the same thing on Stack Overflow, and there were several answers, but none of them works really perfect.)
I have a folder with the following files there:
1.mp3 1.mp3.mp4 1.mp4.mp3 1.txt 2.mp3 2.mp3.mp4 2.mp4.mp3 2.txt foo.mp3 foo.mp3.mp4 foo.mp4.mp3 foo.txt foo1.mp3 foo1.mp3.mp4 foo1.mp4.mp3 foo1.txt foo2.mp3 foo2.mp3.mp4 foo2.mp4.mp3 foo2.txt
Filenames like foo.mp4.mp3
mean that originally the file was MP4 and later converted to MP3.
I need to batch rename MP3 files there, so that their numbers will be padded with leading zeros, that is, 1.mp3
should be renamed 0001.mp3
, 1.mp4.mp3
to 0001.mp4.mp3
, foo1.mp3
to foo001.mp3
, and so on.
Here are several attempts by other people:
rename -n 's/(\d+)/sprintf "%03d", $1/e' *.mp3
rename -n 's/(\d+)\.mp3/sprintf "%03d.mp3", $1/e' *.mp3
rename -n 's/(\d+)(\.mp3)/sprintf("%03d", $1) . $2/e or s/(\d+)(\.mp3)/sprintf "%03d%s", $1, $2/e' *.mp3
rename -n 's/(\d+)(\.mp3)/sprintf "%03d%s", $1, $2/e' *.mp3
rename -n 's/(\d+)(?=\.mp3)/sprintf "%03d", $1/e' *.mp3
- and my own, doesn't work either:
rename -n 's/(\d)(\.[^.]+)/sprintf "%03d%s", $1, $2/e' *
Maybe there is a Perl wizard here who could help me?
submitted by /u/Impressive-West-5839
[link] [comments]
Hello Perl Community. I was trying to build a secure string library in C resistant to buffer overflow vulnerabilities when I realized parsing inputs matters. Perl is well known for string rendering. What books would you recoendnd to a proficient C coder that is trying to learn Perl to master the art of parsing and editing strings to avoid common security exploits?
submitted by /u/fosres
[link] [comments]
submitted by /u/oalders [link] [comments] |
Deploying Dancer Apps (Addendum)
Some more thoughts about deploying Dancer apps as persistent daemonsPerl.com
submitted by /u/briandfoy [link] [comments] |
- YouTube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.www.youtube.com
#!/usr/local/bin/perl use v5.40; use Syntax::Operator::Matches qw( matches mismatches ); use Type::Tiny; my $x = "123"; my $y; my $z = 'abc'; if ( $x matches $z ) { say "1"; } else { say "2"; }
Coded runs and compiles fine.
perltidy error
MacBook Pro 2021:lt administrator$ perltidy matches.pl matches.pl: Begin Error Output Stream matches.pl: matches.pl: 9: if ( $x matches $z ) { matches.pl: -- ^ matches.pl: found bareword where operator expected (previous token underlined)
.perltidyrc
# PBP .perltidyrc file # Uncomment #-st to fully emulate perltidy -pbp -l=278 # Max line width is 78 cols -i=4 # Indent level is 4 cols -ci=4 # Continuation indent is 4 cols #-st # Output to STDOUT -b # Write the file inline and create a .bak file -se # Errors to STDERR -vt=2 # Maximal vertical tightness -cti=0 # No extra indentation for closing brackets -pt=1 # Medium parenthesis tightness -bt=1 # Medium brace tightness -sbt=1 # Medium square bracket tightness -bbt=1 # Medium block brace tightness -nsfs # No space before semicolons -nolq # Don't outdent long quoted strings #-icb # Break before all operators -wbb="% + - * / x != == >= <= =~ !~ < > | & = **= += *= &= <<= &&= -= /= |= >>= ||= //= .= %= ^= x= matches"
spent an hour on this without luck; is there anyway to make perltidy aware of the imported matches operator?
submitted by /u/kosaromepr
[link] [comments]
Is there a way to make a readonly blessed reference that detect attempts to modify it at compile time of the script? Package Readonly , Package Const::Fast and Readonly::Tiny die at runtime
submitted by /u/ReplacementSlight413
[link] [comments]
Hi,
I have been programming in perl for the last 25 years but things have dried up with my long term set of clients recently. I see a lot of posts on here about how there is a huge amount of perl code out there and a need for experienced perl developers ... but I am struggling to find it. I used to go to jobs.perl.org but there hasn't been much there for ages. Upwork seems to have minimal perl projects, so I am a bit stumped. I was on LinkedIn for ages but it became too much of a spammer's paradise.
I'd really appreciate some tips on how to re-expand my client base in 2024!
Rob
submitted by /u/GeneralIsopod6298
[link] [comments]
This works and returns several files: ``` my $image_name = quotemeta('Screenshot-2024-02-23-at-1.05.14'); my $files = $wac->get_all_files_in_dir($dir . '/uploads', qr/$image_name.*\.png$/); ``` This returns no files: Note the space in the file name before AM. This also returns no files: I tried with and without quotemeta and with and without /Q /E to no avail. Is it possible the space is some kind of invisible UTF8 character? This is driving me nuts. **UPDATE:** I jumped on regex101.com and copied and pasted in the file name from the terminal and indeed there appears to be some kind of hidden character that is not whitespace: Did a hex dump of the string: 00000000 53 63 72 65 65 6E 73 68 - 6F 74 2D 32 30 32 34 2D Screenshot-2024- 00000010 30 32 2D 32 33 2D 61 74 - 2D 31 2E 30 35 2E 31 34 02-23-at-1.05.14 00000020 E2 80 AF 41 4D 2D 31 30 - 32 34 78 36 39 38 2E 70 ...AM-1024x698.p 00000030 6E 67 0A ng. submitted by /u/anki_steve |
submitted by /u/briandfoy [link] [comments] |
Perl Weekly #680 - Advent Calendar
Originally published at Perl Weekly 680 Hi there, I know we still have 4 months before the Advent...Gabor Szabo (DEV Community)
submitted by /u/briandfoy [link] [comments] |
Which way would you like to refresh the advisory data for CPAN::Audit? · briandfoy cpan-audit · Discussion #61
At the moment, CPAN::Audit updates the data it uses by releasing a new version of itself. Even if the code has not changed, the versions of the module and tools change. That gives the appearance of...GitHub
[link] [comments]
Perl and Raku Conference 2024 Sessions Now Available Online
Programming book reviews, programming tutorials,programming news, C#, Ruby, Python,C, C++, PHP, Visual Basic, Computer book reviews, computer history, programming history, joomla, theory, spreadsheets and more.www.i-programmer.info
submitted by /u/briandfoy [link] [comments] |
- YouTube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.www.youtube.com
I try to use Perl's rename
utility to translate filenames to lower case. I tried two different solutions, one from perldoc rename
and another from Perl Cookbook:
rename 'y/A-Z/a-z/' ./*
rename 'tr/A-Z/a-z/ unless /^Make/' *.txt
But either version gives me an error because of complaining that file with such a filename already exists:
./fOoBaR.tXt not renamed: ./foobar.txt already exists
How to make it work?
submitted by /u/Impressive-West-5839
[link] [comments]
While refactoring some code with the usual desire to improve/simplify, I came by this interesting example on S.O. that uses the dispatch table structure:
ref _ https://stackoverflow.com/questions/844616/obtain-a-switch-case-behaviour-in-perl-5
my $switch = { 'case1' => sub { print "case1"; }, 'case2' => sub { print "case2"; }, 'default' => sub { print "unrecognized"; } }; $switch->{$case} ? $switch->{$case}->() : $switch->{'default'}->(); #($switch->{$case} || $switch->{default})->() # ephemient's alternative
Dispatch tables are powerful and I use them often.
Gabor Szabo offered a post with an example of given/when, but in the end he suggests just using the if/else construct.
given ($num) { when ($_ > 0.7) { say "$_ is larger than 0.7"; } when ($_ > 0.4) { say "$_ is larger than 0.4"; } default { say "$_ is something else"; } }
ref _ https://perlmaven.com/switch-case-statement-in-perl5
= = =
Which approach do you prefer? Or do you prefer some other solution? Saying no to all the above is a viable response too.
submitted by /u/singe
[link] [comments]
Obtain a switch/case behaviour in Perl 5
Is there a neat way of making a case or switch statement in Perl 5?. It seems to me they should include a switch on version 6. I need this control structure in a script, and I've heard you can impo...Stack Overflow
perl -CADS -le 'print $ARGV[0]' -- -v=αβγ -v=αβγ perl -CADS -sle 'print $v' -- -v=αβγ αβγ
submitted by /u/appomsk
[link] [comments]
[link] [comments]
(dviii) 11 great CPAN modules released last week
Updates for great CPAN modules released last week. A module is considered great if its favorites count is greater or equal than 12. App...niceperl.blogspot.com
Are there new modern alternatives to PerlNET? I am using a Perl game automation library whose ui is built with Wx using Perl bindings. I want to create my own UI using C#(WPF) so wanted to kno if there are existing solutions to this?
submitted by /u/vizim
[link] [comments]
submitted by /u/briandfoy [link] [comments] |
- YouTube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.www.youtube.com
If you have some time, read this post over at reddit
https://www.reddit.com/r/bioinformatics/s/lcxEeInCOS
Apparently Anaconda is ActiveStating people and this may very well prove to be a significant issue in the dominance of Python in certain data science fields. Bioinformatics is a very good example of a field that got addicted to Python and the reliance of Anaconda is coming back to bite (the post and the responses raise the prospect of nightmarish scenarios for other environment managers like conda-forge/buoconda). The immediate solution for dependency management is to dockerize everything, but many tools require individual docker containers. If you have to combine more than one of them, chances are that your path will not be a rosy one.
submitted by /u/ReplacementSlight413
[link] [comments]
Although this StackOverflow question about "islands and gaps" is titularly about Perl, the SQL answers are very nice. Apparently this is a FAQ for SQL.
However, this has bugged me for years on the CPAN side, but never enough to make me really do anthing about.
I thought there was a Perl module that did this, and it was in the context of a usenet reader that would take a list of article IDs, such as 1, 2, 3, 4, 5, 7, 10, 11, 15 and return something like 1-5,7,10-11,15
as a more space-efficient store of all the articles you had read.
Every time I've looked I've stopped after 15 minutes because I get distracted and I've never really needed this except to answer someone else's question. I'm not asking how to solve this because there are plenty of algorithm tutorials out there. Surely this is on CPAN somewhere.
There are plenty of options to go the other way and to ask if a number is in one of the ranges.
- Usenet was pre-web reddit, and comp.lang.perl and comp.lang.perl.misc are where I got my start in the Perl socials before there was "social".
submitted by /u/briandfoy
[link] [comments]
Perl: makes array of item ids shortened
So, I have a large set of numbers, basically 1001 .. 150000 for a database using MySQL There are a ton of gaps in the IDs on the database, so not all IDs exist. It can go from 100000 - 10500, then ...Stack Overflow
submitted by /u/briandfoy [link] [comments] |
- YouTube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.www.youtube.com
submitted by /u/briandfoy [link] [comments] |
GitHub - PerlToolsTeam/github_workflows: Some useful (and reusable) GitHub Workflows
Some useful (and reusable) GitHub Workflows. Contribute to PerlToolsTeam/github_workflows development by creating an account on GitHub.GitHub
submitted by /u/briandfoy [link] [comments] |
- YouTube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.www.youtube.com
[link] [comments]
(dvii) 7 great CPAN modules released last week
Updates for great CPAN modules released last week. A module is considered great if its favorites count is greater or equal than 12. DBD...niceperl.blogspot.com
Good afternoon, all. I have a Perl script that connects to a bunch of REST-based services via LWP::Simple. I'm running on MacOS (Perl v5.30). One of these services moved to be SSL-based. I've been struggling to find an appropriate library to use for SSL with Perl. These libraries require a certain amount of certificate management on my Mac -- and integration with Perl via environment variables or such -- and the instructions are generally sparse/obtuse. Can anybody help with this? I'm not looking to do anything particularly fancy. Just call a REST service via HTTPS. Thanks in advance for your help.
submitted by /u/Ok_Pepper_6594
[link] [comments]
We need to be able to work with parquet files. It is a must.
For anyone cares a solution could me a native DuckDB driver. It is a pitty we do not have it.
George Bouras
submitted by /u/kzxfdjgheirhgfkds
[link] [comments]
I am following instruction to the t; both with CPANM and from source the install fails.
OPEN_SSL prefix is set as followed
export OPENSSL_PREFIX="/usr/local/opt/openssl@1.1"
Full error message here:
https://jumpshare.com/s/QMxo2rY1sf8j3nYGyEo8
Anyone able to help? Pulling my hair out.
submitted by /u/kosaromepr
[link] [comments]
[link] [comments]
Perl Advent Calendar 2024 CFP
The Call For Participation for the 2024 Perl Advent Calendarcfp.perladvent.org
I'm getting an SSL failure , and I can’t figure out what isn’t migrated properly from the perl setup
'auto_upgrade' => 1 }, 'Mojo::Asset::Memory' ) }, 'Mojo::Content::Single' ), 'error' => [ 'IO::Socket::SSL 1.75 required for TLS support' ], 'finished' => 3, 'state' => 'finished'
It seems to be using the same exact local Perl config but after a long time chasing I have dumped out the module includes for perl and it is failing to load the file:
$VAR475 = 'IO/Socket/SSL.pm';
$VAR476 = undef;And $VAR161 = 'Net/SSLeay.pm';
$VAR162 = undef;
Whereas on the working (current, old server)It’s printing out correctly:
$VAR479 = 'IO/Socket/SSL.pm';
$VAR480 = '/var/home/tyeeapps/support.thetyee.ca/www/local/lib/perl5/IO/Socket/SSL.pm';$VAR161 = 'Net/SSLeay.pm';
$VAR162 = '/var/home/tyeeapps/support.thetyee.ca/www/local/lib/perl5/x86_64-linux/Net/SSLeay.pm';
I've reinstalled the revelant modules from yum at the system level, which shouldn't matter. As well as on the perlbrew install in play, and in Carton, which the app is using
relevant line of code:
which does:
$res
= $ua->post( $API
. 'subscriptions' =>
{ 'Content-Type' => 'application/xml', Accept => '*/*' } =>
$transxml )->res;
}
my $xml = $res->body;
submitted by /u/nkrva
[link] [comments]
support.thetyee.ca/app.pl at e5cf4fd189ea4256c7de2a4f91303908770125a7 · TheTyee/support.thetyee.ca
The Tyee's bespoke crowdfunding platform. Contribute to TheTyee/support.thetyee.ca development by creating an account on GitHub.GitHub
submitted by /u/briandfoy [link] [comments] |
- YouTube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.www.youtube.com
[link] [comments]
Commits · PerlToolsTeam/psc
List of Perl Steering Council meetings. Contribute to PerlToolsTeam/psc development by creating an account on GitHub.GitHub
submitted by /u/briandfoy [link] [comments] |
- YouTube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.www.youtube.com
submitted by /u/briandfoy [link] [comments] |
- YouTube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.www.youtube.com
[link] [comments]
Deploying Dancer Apps (Addendum) - Perl Hacks
Back in May, I wrote a blog post about how I had moved a number of Dancer2 applications to a new server and had, in the process, created a standardised procedure for deploying Dancer2 apps.Dave Cross (Perl Hacks)