I want to process lines that start on "ROW<number> blabla" and increment the number by 2. Eg: "ROW13 There's a lazy brown fox" -> "ROW15 There's a lazy brown fox".
My first attempt:
perl -pe 's/(\d+)/$1+2/e'
works but replaces numbers EVERYWHERE not just after ROW, so I tried:
perl -pe 's/ROW(\d+)/ROW$1+2/e'
but this doesn't work at all.
submitted by /u/redzorino
[link] [comments]
The latest dev release of Type::Tiny made some changes to its behavior with tie.
Being the kind of person who enjoys playing with shiny new things, I went to see how I could wrangle it into core classes:
```perl use v5.40; use experimental qw<class>;
class Foo { use Types::Standard qw<Int>; field $bar :param; ADJUST {tie $bar, Int, $bar} }
Foo->new(bar => "baz");
Value "baz" did not pass type constraint "Int"
```
Neat!
submitted by /u/m_dango
[link] [comments]
[This article](https://dev.to/jj/creating-new-perl-composite-actions-from-a-repository-template-3c0k) tells you how to use [this repo template](https://github.com/JJ/perl-composite-action-template?tab=readme-ov-file) to create your own. For instance, one like [this one that matches the version in the examples to that in the repo](https://github.com/marketplace/actions/check-version-in-readme-is-latest)
submitted by /u/Sea-Bug2134
[link] [comments]
Creating new Perl composite actions from a repository template
What's in a template for composite actionsJuan Julián Merelo Guervós (DEV Community)
There was a cool neon-sign-style sticker given out at TPRC 24 which has a dart board and a dart in the bullseye, and the dart board is on fire...just curious
submitted by /u/thelastcubscout
[link] [comments]
Kind of retired now after developing with Perl for the past 20 years, but I still maintain a large Perl code base as a hobby for a club. Just as well as there's little Perl work around in the UK.
The last straw was a mix of things, that `LWP` doesn't support `HTTP2` (so I have to `qx" curl ... "`), the syntax of destructuring a hash-ref, and that no one (in the club) but me knows (or wants to know) Perl, so there is no succession plan.
A large part of the site is Javascript, which made node-js the best migration target as I already half know it
For me, it's a worthy successor to Perl. Its actually quite similar. The language is already way too big (and getting bigger) so that you can look at someone else's code and not understand it 😀 And NPM is like CPAN, lots of similar modules, half of which abandonware, to choose from and you don't know which one to choose
Sure, some things are better... built-in curl (ie fetch/LWP) and convert to/from JSON, JSON like syntax for variables, destructuring objects, private variables and methods in classes, package.json (a config file)
And some much worse ... no `/x` on regex, no `statement if condition`, no auto-vivifying, no log4perl or template toolkit, no "-e file" ). It really pisses me off removing whitespace from regex knowing that /x will be added as a language feature one day. Yes I could of ...
But, overall, more things are better than worse.
In case you try it, even with a convert script, its a lot of work and a little tedious at times going through line by line
It would be great to have a version of Perl with JSON syntax for variables, but I guess, as it would break everything, it is too late.
To all those who have maintained Perl and CPAN modules over the years, THANK YOU.
submitted by /u/Loose_Potential6985
[link] [comments]
This project is moving along just fine. Below is the current leaderboard. It's not about personal module count, it's creating more awareness about Perl. Also, some of these APIs are actually pretty neat! E.g., there's a "card deck" API for card playing programs.
All are invited to participate. Please click here for the rules and to claim the API. This is a great way to get your first CPAN module published, which is a major milestone for any Perl programmer. It's also great for experienced devs to blow off some steam or hone their skills. If you're new to CPAN and need help, email me directly at [oodler@cpan.org.](mailto:oodler@cpan.org)
The runner of FreePublicAPIs has been extremely supportive of this effort. He even created a site API for us, and I obliged by creating a real Perl client for it!
I'd like to specifically request that anyone using any of the new Perl stuff like signatures or Corinna/class
to submit some as non-contrived examples of how they work or as proof of why people should use them. Here is a good summary of the new features in Perl 5.40 - give it a shot! I may even try something other than my Dispatch::Fu and Util::H2O::More modules, even though they makes writing commandline tools with subcommands and web API modules dead simple - TIMTODI!
Claimed | PAUSE | API Info | Module Name | Status | Completed |
---|---|---|---|---|---|
2024-08-28 | OODLER | kanyerest | Acme::Free::API::Ye | Completed | 2024-08-28 |
2024-08-29 | OODLER | chuck-norris-jokes-api | Acme::Free::API::ChuckNorris | Completed | 2024-08-29 |
2024-08-30 | OODLER | reddit-stocks | Acme::Free::API::Stonks | Completed | 2024-08-30 |
2024-08-31 | SANKO | advice-slip-api | Acme::Free::Advice::Slip | Completed? | 2024-09-03 |
2024-08-31 | SANKO | unsolicited-advice-api | Acme::Free::Advice::Unsolicited | Completed? | 2024-09-03 |
2024-09-01 | CAVAC | ip-geolocation-api | Acme::Free::API::Geodata::GeoIP | Completed | 2024-09-01 |
2024-09-03 | OODLER | dog-api | Acme::Free::Dog::API | Completed | 2024-09-04 |
2024-09-03 | SANKO | insult-api | Acme::Insult::Glax | Completed? | 2024-09-03 |
2024-09-03 | SANKO | evil-insult-generator | Acme::Insult::Evil | Completed? | 2024-09-03 |
2024-09-03 | OODLER | api | Acme::Free::Public::APIs | Completed | 2024-09-06 |
2024-09-06 | OODLER | keyval-api | WebService::KeyVal | Pending | |
2024-09-07 | HAX | ipify | Webservice::Ipify | Pending |
submitted by /u/OODLER577
[link] [comments]
submitted by /u/leejo [link] [comments] |
London Perl & Raku Workshop, 2024
London Perl & Raku Workshop. Perl & Raku Conference and training in London.act.yapc.eu
[link] [comments]
(dxii) 19 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
Hey friends, a few weeks back we introduced SlapbirdAPM (an open-source Perl application performance monitor), and received some great feedback from the community! Today we'd like to announce that you are now able to track DBI queries in your applications (only available for Dancer2 and Mojolicious for now), regardless of your database, ORM, etc. Here's what it looks like! You can see the dancer2 code that generated these queries here. This is just one of the many monitoring features provided by SlapbirdAPM, hopefully you find them as useful as we do! And a reminder we have a *forever* free tier available for everyone! submitted by /u/ivan_linux |
slapbird/examples/dancer2/dancer2.pl at main · mollusc-labs/slapbird
SlapbirdAPM 🐦: An APM (Application Performance Monitor) for Perl 5 web-applications - mollusc-labs/slapbirdGitHub
Check out the latest version of String::Util and let me if you have any suggestions for other string based funcions I can add.
submitted by /u/scottchiefbaker
[link] [comments]
GitHub - scottchiefbaker/String-Util: Read-only release history for String-Util
Read-only release history for String-Util. Contribute to scottchiefbaker/String-Util development by creating an account on GitHub.GitHub
Since the language formerly known as Perl 6 has officially gone off on its own, has there been any effort to implement a true Perl 5 successor?
In my opinion, Raku tried to do too much with the syntax itself, scaled Perl's flexibility to infinity, and made itself unusable.
Perl 5 does not need much for it to become a "modern" language. Instead of extending the flexibility of the syntax, the direction for Perl 6 should emphasize standardizing core utilities to facilitate integration with modern workflows.
- Package/module management and import/export could benefit from streamlining
- Stronger LSP and debug/error tooling (Rust has spoiled me)
- "Prettier" auto-formatting for source code (For those 30yo system scripts, you know the ones I mean)
What would be on your wishlist?
submitted by /u/J_Stach
[link] [comments]
Just click the link: https://shell.cloud.google.com/?pli=1&show=ide%2Cterminal
System perl is 5.34. 5.40 work if you skip man::db
perlbrew install --noman -n perl-5.40.0
It was easy to run a Dancer2 app and view via "Web Preview"
submitted by /u/ktown007
[link] [comments]
I've been writing an example web application using Dancer2.
Well, I say I've been writing it. Actually, I've been specifying it and GitHub Copilot Workspace has been writing the code. It has been interesting (and, rather more successful than I expected).
I shall continue with the experiment.
submitted by /u/davorg
[link] [comments]
GitHub - davorg/dancer-example: Basic Dancer2 example
Basic Dancer2 example. Contribute to davorg/dancer-example development by creating an account on GitHub.GitHub
Hi. I want to update a perl module (Spreadsheet::ParseExcel) from v0.65 to v0.66. I've transferred the module on the target machine. However, "make", "dmake", and "gmake" are all not available as methods to install this module, neither is cpan. The machine is completely isolated from the internet and absolutely cannot be modified to connect. How would I go about updating such a module without using the usual installation methods? Essentially, my question is that can I replace the ParseExcel(.)pm file and ParseExcel folder manually with no issues? Appreciate any help.
submitted by /u/Coconut_Cove
[link] [comments]
Setup:
Perl v5.40
AlmaLinux release 9.4
Nginx
Spawn-fcgi
First of all I know there are better ways than using Spawn-fcgi and we are looking at some refactoring; until then we are seeing child processes forked with Spawn-fcgi die from time to time and I have not been able to figure out a way on how to catch them / troubleshoot what is going on/killing them
I have a big try/catch clause in the moment the call comes in
while ( my $q = CGI::Fast->new() ) { eval {
but its not really catching anything when the processes die. I do have the process ids but I cannot really correlate them to anything in the nginx logs. At the same time I would not expect for nginx to "kill" any fcgi processes or could it?
Any pointers much appreciated.
submitted by /u/kosaromepr
[link] [comments]
In the latest Canonical announcement for Ubuntu 24.04.1 availability, Perl is mentioned among a small list of other programming languages:
As the target platform for open source software vendors and community projects, Ubuntu 24.04 LTS ships with the latest toolchains for Python, Rust, Ruby, Go, PHP and Perl, and users get first access to the latest updates for key libraries and packages.
It’s also mentioned as well in the “Ubuntu for developers” use case:
Ubuntu ships with the latest toolchains for Python, Rust, Ruby, Go, PHP and Perl, and users get first access to the latest updates for key libraries and packages.
Note they call all those “cutting-edge software”…
This is quite unusual in the last few years, and the initial announcement for Ubuntu 24.04 in April didn’t mention it.
What is going on and what do you think?
submitted by /u/sebf
[link] [comments]
[link] [comments]
(dxi) 15 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
submitted by /u/OODLER577 [link] [comments] |
GitHub - oodler577/FreePublicPerlAPIs: You have a cordial invitation to participate in growing the list of Perl modules and clients created for the web services listed at www.freepublicapis.com/
You have a cordial invitation to participate in growing the list of Perl modules and clients created for the web services listed at https://www.freepublicapis.com/ - oodler577/FreePublicPerlAPIsGitHub
I wanted a quick way to convert 255.255.255.252 -> 30 and other netmasks... this works!
$mask =~ /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/ or next;
$cidr = 32 - (log(256-$1)+log(256-$2)+log(256-$3)+log(256-$4)) / log(2);
submitted by /u/sfxsf
[link] [comments]
I have been working as a freelance developer for the last 9 years, about 80% of that has been PHP based.
I just landed a big, possibly once in a lifetime client that has a just about 30 year old code base.
I am completely new to perl, I have done some crash course reading to understand syntax, operators etc.
For the most part I can read and understand the code, on my third day I discovered the architecture.
It's basically 4 systems in one root folder, each of those systems basically contain a package file and a index file which seems to contain the entire system within that that file.
There are references to templates (Template Toolkit) and other things outside the file but for the most part all the business logic is one file.
While going through this I realized there was non of the standards I had been accustomed to in PHP and other projects.
Archaic routing (basically none), the closest thing to a function an if statement that else ifs it's way down thousands of lines of code.
So I have some ideas to implement routing, modularity and probably convert the conditions to sub routines (we call these functions in my old club)
It's like take a journey back in time to an era that I was not around for.
With that being said, knowing what you know, what suggestions, secrets, tips or warnings would you be willing to share?
Edit: Great community! Who says perl is dead 😀 so many great resources, thank you so much! I will be spending a lot more time on this sub!
submitted by /u/Mowntain-Goat8414
[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
[link] [comments]
On the [b]leading edge - Perl Hacks
We need programmers who like to play on the bleading edge. By trying out new features, they are able to report on problems that they find - and, in doing so, improve the experience for the many people who follow them.Dave Cross (Perl Hacks)
submitted by /u/oalders [link] [comments] |
I'm Still Lazy
I wrote an auto-installer for Perl modules, but I was too lazy to fix it.Olaf Alders (www.olafalders.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
Hi all! I have a bug in my script I can't locate and I'm sure it must be some silly thing.
I am using a SQLite database with a contacts table that includes a field for the date in which the contact was added or edited. This is a DATE type field defined as "editado" date NOT NULL
.
I search for a group of contacts by doing this (nomap
is a string field with name and lastname):
sub cntSearch( $srch ) { my @result = (); my $tosrch = $srch; $tosrch =~ s/([\\%_'"\[\]])/\\$1/g; # LIKE no admite $dbh->quote() $sth = doSQL( "SELECT * FROM contactos WHERE nomap LIKE '%$tosrch%' ORDER BY nomap" ); while ( $hr = $sth -> fetchrow_hashref() ) { utf8::decode( $hr->{nomap} ); push @result, $hr; } return @result; }
At this point, if I read
$hr->{editado}
, I get the string I want (a date in the YYYY-MM-DD format). But when I do this:my @cntlist = cntSearch( $srch ); for ( @cntlist ) { my ( $codigo, $nomap, $ref, $editado ) = ( $_->{codigo}, $_->{nomap}, $_->{referencia}, $_-->{editado} ); }
the variable
editado
gets the value 1.The actual code is more complex but this is the gist of it and I think the other stuff is not related.
Any advice on this would be appreciated!
submitted by /u/elbitjusticiero
[link] [comments]
Perl was (and still) is used for system administration to this day. If you have professional system administration experience what have you seen Perl used for in sysadmin practices the most?
When would you recommend it? When would you not recommend it and what would be the alternativein which case?
Do you still see coworkers and yourself using Perl for such tasks. I ask because I'm confused as to how Perl stands up as a system admin tool compared to other options in modern times.
submitted by /u/fosres
[link] [comments]
submitted by /u/oalders [link] [comments] |
GitHub - fglock/PerlOnJava: An implementation of the Perl programming language designed to run on the Java platform
An implementation of the Perl programming language designed to run on the Java platform - fglock/PerlOnJavaGitHub
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/ReplacementSlight413 [link] [comments] |
GitHub - chrisarg/task-memmanager
Contribute to chrisarg/task-memmanager development by creating an account on GitHub.GitHub
This is my first attempt to create a Perl script.
This script is to convert Markdown files to plain text ones, with some "common" typographic substitutions.
When I finish it, it is assumed to work as follows:
- Single-hyphen dashes are replaced with three hyphens: that is,
foo - bar
is replaced withfoo---bar
- Markdown-style italic is replaced with Org Mode-style italic: that is,
foo *bar* baz
is replaced withfoo /bar/ baz
- Blank lines are replaced with first-line indents, that is:
``` FROM THIS This is a 500-character line of text.This is another 500-character line of text. ```
TO THIS This is a 500-character line of text. This is another 500- character line of text.
- Lines are hard-wrapped at 72 characters, and additionally:
- Any single-letter word, such as "a" or "I", if it happened to be at the end of a hard-wrapped line, unless it is the last word in a paragraph, is moved to the next hard-wrapped line, that is:
FROM THIS He knows that I love bananas.
TO THIS He knows that I love bananas.
And now the first draft. Please don't laugh too loudly 😀
```
!/usr/bin/perl
perl -pi -e 's/ - /---/g' $1 # foo - bar to foo---bar perl -pi -e 's/*///g' $1 # foo to /foo/ perl -pi -e 's/\n{2}/\n /g' $1 # blank lines to first-line indents ```
The first two lines work fine.
But I really don't understand why the third line doesn't replace blank lines with first-line indents.
Also, maybe someone can point me to an existing Perl or Awk script that does all of this.
submitted by /u/No-Usual-9631
[link] [comments]
[link] [comments]
(dx) 19 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
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
This is not Perl specific, but in our new era of this Perl economy everyone should be thinking about side-hustles and income streams. Perl is perfect for creating SaaS and other services because for efficient practitioners it presents the most efficient way to prototype a lot of things via the web.
For example, shared hosting is dirt cheap and supports cgi-bin; VMs on the cloud are also dirt cheap and you probably don't need more than a $5 instance to POC something that will be good enough to test interest. Knowing more about pricing models is part of that. This is an interesting article about SaaS pricing models, and know more about that is certainly part of creating paid services. Enjoy.
https://garrettdimon.com/journal/posts/data-modeling-saas-entitlements-and-pricing
* sorry the code examples in here are Python, but I think for this purpose we can look past that
submitted by /u/OODLER577
[link] [comments]
Hi all! This is my first Perl script.
#!/usr/bin/perl use strict; use warnings; use Curses::UI; use Data::Dumper; use JSON; # Create the root Curses::UI object my $cui = Curses::UI->new(-color_support => 1); # Set up a signal handler to exit on Ctrl+C $cui->set_binding(sub { exit(0); }, "\cC"); # Create the main window my $win = $cui->add('window_id', 'Window'); # URL to fetch email address my $response = "https://www.1secmail.com/api/v1/?action=genRandomMailbox&count=1"; # Variable my $email_address = ''; my $username = ''; my $domain = ''; my $formatted_email = ''; my $formatted_json = ''; my $formatted_inbox = ''; my $Id = ''; my $box = ''; # my $filename = '/home/ola/Work/Languages/Perl/curses-ui/1/TempMail-Curses-UI/file.txt'; # Calculate the center Y position based on the window height my $window_height = $win->height(); my $center_y = int(($window_height - 1) / 2); # Create $win->add( 'buttonbox_id', 'Buttonbox', -y => $center_y, -buttons => [ { -label => '< Get Random Email >', -onpress => sub { $email_address = `curl -sL $response`; chomp($email_address); $email_address =~ s/^\["(.*)"\]$/$1/; print $email_address; # Split the email into username and domain my ($username, $domain) = split('@', $email_address); chomp($domain); print "Username is: $username\n"; print "Domain is: $domain\n"; # Copy system("echo $email_address | xsel --clipboard --input"); # Write to file open(FH, '>', $filename) or die $!; print FH $email_address; close(FH); # print "Writing to file successfully!\n"; # Send test mail # system("perl SendMailTest.pl"); # Display the output in a dialog $cui->dialog( -message => "Random Email:\n$email_address\n Copied To Clipboard", -title => "Email Address", -buttons => [ { -label => '< OK >', -value => 1, -shortcut => 'o', } ], ); } }, { -label => '< Update Inbox >', -onpress => sub { # my $command_output = `curl -sL "https://www.1secmail.com/api/v1/?action=getMessages&login=2gqhd4oz4wb&domain=laafd.com"`; my $command_output = `curl -sL "https://www.1secmail.com/api/v1/?action=getMessages&login=$username&domain=$domain"`; chomp($command_output); $formatted_json = decode_json($command_output); $Id = $formatted_json->[0]->{id}; # Display the output in a dialog box $cui->dialog( -message => $formatted_json->[0]->{subject}, -title => "$Id = $formatted_json->[0]->{id}", -buttons => [ { -label => '< Fetch Mail Body >', -value => 1, -shortcut => 'o', } ], ); $Id = $formatted_json->[0]->{id}, # my $inbox = `curl -sL "https://www.1secmail.com/api/v1/?action=readMessage&login=2gqhd4oz4wb&domain=laafd.com&id=$Id"`; my $inbox = `curl -sL "https://www.1secmail.com/api/v1/?action=readMessage&login=$username&domain=$domain&id=$Id"`; chomp($inbox); my $formatted_inbox = decode_json($inbox); my $box = $formatted_inbox->{textBody}; # print Dumper($formatted_inbox); print $box; $cui->dialog( -message => $box, -title => "$Id = $formatted_json->[0]->{subject}", -buttons => [ { -label => '< OK >', -value => 1, -shortcut => 'o', } ], ) } }, ], -buttonalignment => 'middle', ); $cui->mainloop;
This is a script to fetch a temp mail address from the API, then display the contents of its inbox.
Problem
Everything was working fine, but suddenly I'm getting an error about screen size. I am literally clueless at this point.
Error:
Your screen is currently too small for this application.
Resize the screen and restart the application.
Press <CTRL+C> to exit...
Info
Terminal has 45 lines and 189 coloumns, and is full screen.
This is perl 5, version 38, subversion 2 (v5.38.2) built for x86_64-linux-thread-multi
Curses::UI Version: INST_VERSION 0.9609
OS is Arch Linux
submitted by /u/GapIndividual1244
[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
submitted by /u/leejo [link] [comments] |
London Perl & Raku Workshop, 2024
London Perl & Raku Workshop. Perl & Raku Conference and training in London.act.yapc.eu
submitted by /u/oalders [link] [comments] |
Fixing a fifteen-year-old curve fit bug
The backwards compatibility of Perl software is wonderful. That’s why it’s all the more jarring when you find a package that doesn’t work. This is the story of a 15-year-old bug that I managed to track down and, fortunately, resolve.Paul Cochrane (P.T.C.)
submitted by /u/briandfoy [link] [comments] |
Signature named params by leonerd · Pull Request #54 · Perl/PPCs
Another PPC doc to add to the growing pile ;) As is traditional for me I didn't fill in the "Rationale" section as I still have no idea how that differs from a "Motivation"....GitHub