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