|
In a Perl shoppe now. The product seems to have exactly the same level of technical debt and under/over designed issues that I've seen in Java and Python heavy solutions, but the language seems a good fit to focus on the data being managed. Even the newer PMs look at the code, so there don't seem to be many learning troubles. Sadly some of the long tenured people are wrong on some of the details and reluctant to make improvements.
|
# ¿ May 27, 2023 19:49 |
|
|
# ¿ May 11, 2024 17:37 |
|
BattleMaster posted:I don't like how it handles function arguments code:
As programs grow into helpers and objects, it becomes much better to pass named lists: code:
|
# ¿ May 28, 2023 18:57 |
|
Ooo part of an RPM even. I haven't dinked with building RPMs in about ten years. Bash takes a different mindset; it can be a fun exercise. Here's a fun one I didn't know until recently. You know how sed has a range operator, such as /open/../close/d ? It bleeping exists in Perl as well. In list context the .. range operator generates the range, duh, but in scalar context it's a boolean flip-flop operator. You can even do !defined(blah) .. /regexp/ and similar things, multiple instances without collision (ie nested loops work).
|
# ¿ May 31, 2023 01:33 |
|
Random recent find, file test functions are automatically conjunctive. IE, these are the same:code:
|
# ¿ Jun 12, 2023 00:29 |
|
For some reason I've always split on newlines when using qx, which is silly since it automatically splits on the input record separator in list context.code:
|
# ¿ Jun 24, 2023 13:00 |
|
Startyde posted:perl is awk++ (derogatory) https://perldoc.perl.org/perlvar posted:Remember: the value of $/ is a string, not a regex. awk has to be better for something. :-)
|
# ¿ Jun 25, 2023 22:03 |
|
Durrcode:
|
# ¿ Aug 24, 2023 19:35 |
|
But this is the Perl thread, so we love Perl here. As with any language, you get to maintain crap code if you write crap code, but when you adopt better patterns you get to enjoy beautiful code. Perl, as many like to point out, has more than one way to do things, so you are free to adopt a code organization and presentation that matches the needs of the project. Procedural? Yep. Class based? Yep. Functional? Yep. Loaded up with 75 libraries and three lines of code? Yeap, even that. It's so straightforward - rather, conditions, loops, flow control, are "universal", duh - that I worked with TPMs who filed ticket requests with code details and references. I never saw that at the Python, Ruby, and Java shops. They couldn't even find the relevant code.
|
# ¿ Dec 12, 2023 05:02 |
|
It sounds perfectly acceptable, but likely represents poor planning, particularly when you find you need to do the same thing next week with slight variation.
|
# ¿ Dec 26, 2023 08:49 |
|
The Benchmark module has a subtle imperfection: It finds a baseline runtime for an empty eval based on the type of underlying tests but does so only once. Delays at that time may result in later runtimes being reported as negatives, particularly when using the direct timing functions (instead of cmpthese). Obviously benchmarking comes with a ton of caveats, but it's common to build representative baselines, which themselves require statistical measurement. Reporting and subtracting that runtime is likely to make more sense when performance profiling compared to getting some tests with negative average runtimes. I really like how easy it is to quickly benchmark in Perl but this was an interesting choice. If you see some negative times when using the timing functions of Benchmark coupled with timediff, this is the likely culprit. It's much less likely that your clock is jumping backwards.
|
# ¿ Dec 26, 2023 09:13 |
|
Tis interesting that pointers will always cause problems for programmers. One of the most frequent syntax questions I get from our software peeps is their confusion about accessing things in basic and object types. They get confused because there are lots of places in our code where people have chosen to use references and arrow dereferencing. I get the impression that the mid engineers really don't know what's happening and are just trying things until it works. Sadly, but I still see lots of ahha moments when people are sharing examples, doing code reviews and the like. It's amazing how consistent the original syntax is after all these years and language requests.
|
# ¿ Mar 18, 2024 06:41 |
|
Actually measuring minor performance differences of this scale is very difficult and depends on the distribution of inputs, however, there is a different way to structure the pattern:code:
This is "find a literal 22 as a word that is somewhere after a colon". The backslash-b is a "word boundary" that automatically handles all non-letters-digits-or-underscores as well as the beginning and ending boundaries of the string. Also as there's known to be the single colon separating the IP from the port list, this pattern might make more intuitive sense because it shows that everything to the left of the colon doesn't matter. If you want additional validation, the full list of ports, etc., then it changes, but this is still twice as fast as fully splitting the string.
|
# ¿ Apr 16, 2024 05:04 |
|
Hughmoris posted:I was curious about performance of the different solutions. Anyone know best practices for benchmarking scripts in modern perl? I'm thinking I could generate a 1 GB file of IP addresses and ports, and benchmark the different solutions.
|
# ¿ Apr 16, 2024 23:37 |
|
|
# ¿ May 11, 2024 17:37 |
|
Catastrophic backtracking is certainly possible, but happily much less likely in Perl because of the regexp optimizations. I remember being surprised how awful some of the libraries were in (popular languages) a few/five years ago.
|
# ¿ Apr 19, 2024 05:18 |