Serpent7776, to random
@Serpent7776@mastodon.social avatar

I just wasted 1hr, because I used == instead of eq and 'and' instead of && in

mjgardner,
@mjgardner@social.sdf.org avatar

@Serpent7776 use warnings; (or the -w switch for a one-line command) would have helped catch the first problem: https://perldoc.perl.org/warnings

You would then see “Argument "foo" isn't numeric in numeric eq (==)” along with the line number in the code and the string you were trying to compare instead of “foo”: https://perldoc.perl.org/perldiag#Argument-%22%25s%22-isn't-numeric%25s

If you have 2022’s version 5.36 or later, use v5.36; will enable warnings as well as other sane defaults.

/ @perl

mjgardner, (edited )
@mjgardner@social.sdf.org avatar

@Serpent7776 I’m sorry to hear about the warnings lost in the output.

Since you’ve got #Perl v5.38.2, write use v5.38; and in addition to strict and warnings you enable the following niceties from https://perldoc.perl.org/feature :

bitwise
current_sub
evalbytes
fc
isa
module_true
postderef_qq
say
signatures
state
unicode_eval
unicode_strings

You’ll also disable these footgun “features”:

bareword_filehandles
indirect
multidimensional
switch

Give it a whirl!

/ @perl

RogerBW, to raku
@RogerBW@emacs.ch avatar
mjgardner, to perl
@mjgardner@social.sdf.org avatar

@perl Remember folks, 's is a dromedary 🐪, not a Bactrian 🐫:

perl -CS -pe 's/\N{BACTRIAN CAMEL}/\N{DROMEDARY CAMEL}/gu'  
metacpan, to programming
@metacpan@fosstodon.org avatar
dave, to random
@dave@puz.fun avatar

Anyone here have experience updating a Dockerized Perl application? Specifically I am looking for help upgrading the app from 5.26 to 5.30 and how to rectify errors where some libraries (I think?) were built for Perl 5.26 and won't work under 5.30?

#Perl #ModernPerl #PerlDev #Docker #Perl5

philsplace, to random
@philsplace@mastodon.sdf.org avatar

Dropping some Perl right in the middle of some Template::Toolkit code is the best thing about TT #imho

mjgardner,
@mjgardner@social.sdf.org avatar

@philsplace
@perl “[#Template languages have] two problems: First, their little language is crippled. If you need to do something the author hasn't thought of, you lose. Second: Who wants to learn another language? You already know #Perl, so why not use it?“

Cut out the middleman and use Text::Template: https://metacpan.org/pod/Text::Template

RL_Dane, to raku
@RL_Dane@fosstodon.org avatar

Lol, and folks, I made a funny (in bash!)

#!/usr/bin/env bash

CD - uses my ulocate script and fzf to jump to any directory found within my home directory

set -u undeclared variables as errors

function warn {
echo "$" >&2
}
function swoon { # (something in between a warn and a die ;)
warn "$
"
exit 0
}
function die {
warn "$*"
exit 1
}

ferki, to KindActions
@ferki@fosstodon.org avatar

perlthanks is a shortcut for perlbug -T to "send a thank-you note instead of a bug report".

With #Perl, #gratitude is a feature.

See the docs: https://perldoc.perl.org/perlthanks#Can-you-use-perlbug-to-submit-a-thank-you-note

RogerBW, to raku
@RogerBW@emacs.ch avatar
benjamineskola, to random
@benjamineskola@hachyderm.io avatar

Started reading ‘Modern Perl’ on the train to work the other day. was the first programming language I learned, 20 years ago now, but I’ve hardly used it in probably 15 years now.

Not yet sure what I’d use it for, though. Better shell scripts? I’d normally choose Python/Ruby for that.

profoundlynerdy,
@profoundlynerdy@bitbang.social avatar

@benjamineskola There is a very new OOP system: https://ovid.github.io/articles/the-future-of-perl.html which looks good but I haven't actually used it myself.

I work Cybersecurity, I mostly use for quick one-off scans when someone asks me, "are we vulnerable to XYZ?" when XYZ has a (mis)configuration element to it.

A lot of my hobby code is using these days as I really enjoy the language's mutability.

oalders, to programming
@oalders@fosstodon.org avatar
ChristosArgyrop, to Bash
@ChristosArgyrop@mstdn.science avatar

This made my night #bash #script #perl

image/jpeg

metacpan, to programming
@metacpan@fosstodon.org avatar

What's New on CPAN, March 2024 edition.

https://www.perl.com/article/what-s-new-on-cpan-march-2024/

#perl @perl @tag@relay.fedi.buzzl #programming

ovid, to javascript
@ovid@fosstodon.org avatar

I started programming in 1982. Though I'm known as a developer, I tried to remember every other languages I've programmed in.

, #C, 6809 Assembler, , VBScript (and its many variants), , , , , , , Easytrieve, and probably a few others.

I wish I had gotten a job in Prolog, primarily because I loved what I could create with it. I don't love programming; I love creating.

What are you languages?

mina,
@mina@berlin.social avatar

@ovid

Basic, Pascal, C/C++, JavaScript, Tcl/Tk, Bash, Prolog quickly from my head

My favourite, though, is #Perl.

RogerBW, to raku
@RogerBW@emacs.ch avatar
leonerd, to random
@leonerd@fosstodon.org avatar

How's your day going?
#perl

genehack, to random
@genehack@dementedandsadbut.social avatar
EricMesa, to golang

A few thoughts on Programming languages

Just a few thoughts on programming languages that have been rattling around in my head this week, but which don’t each merit a full blog post. The main theme is that the culture behind each programming language leads to some interesting choices, as is the case with spoken languages.

This week I started learning how to program in Rust. Even though I’m using the project-based Command-Line Rust to learn, the author still went with the traditional “Hello, world!” project for the first intro to the language. I was also working on a Go project last week and so it immediately stood out to me that (at least as taught by this author) Rust has the print! macro that allows you to succinctly print to the command line. By contrast, Go requires importing fmt before you can print. This was the first topic that was swirling around in my head this week. What makes language designers choose whether printing output (one of the most basic things a program can do) is built-in or requires an import. I even remember back when I was learning Java in undergrad (I think it was Java 1.8, but I don’t remember) we had to use the savitch library just to get program input (another very basic computer program concept). As I thought about it, I wondered if it has to do with thoughts around compilation and whether the language designers think you’re mostly making user-interactive programs or libraries? It makes sense to me that scripting languages like Python, Ruby, and Perl would have print built-in since you always have to have the interpreter along with you, so all the basics should be there. (The original Batteries Included Python promise, for example) But perhaps the Go developers thought you wouldn’t always be printing to the command line so a more efficient binary could be compiled by forcing you to import the functionality? I’m not entirely sure.

The next thing I started thinking about, again due to learning Rust, was the mutability of variables. In most languages I’ve come across (I think all, except Haskell) all variables are mutable by default. It almost seems pointless to have a non-mutable variable. I understand why many languages have the concept of a “contanst” modifier/keyword. Unlike normal variables, THIS ONE does not change. But the opposite seems so weird since most of what we often do in programming involves changing the value in a variable. Perhaps as I learn more about Rust, I’ll understand their reasoning, but this seems completely backwards to me.

Both Rust and Golang use structs to organize variables where Ruby, Python, and Java use objects. But when both Go and Rust allow you to “attach” methods/functions to structs – is there a true distinction between object-oriented programming and struct-based programming? It seems like it’s just semantics (in the generic sense of the word) – at least at the level at which I program. The only difference I can see is that structs don’t have inheritance, although Go’s “types” solve some of the same problems.

Today’s (the day I’m writing this, not the day it’s going to be posted) shower thought was about programming language versions. On one end you have Java (I think now on version 22) and C# (now at version 12). On the other you have Python and Ruby (both at version 3). Perl essentially stopped at 5 with Perl 6 evolving into Raku. I don’t know what Java is up to. But I think C# is actually using the versions correctly – I’ve heard that each version introduces completely different ways of doing things and that the way you program C# depends strongly on when you jumped in. This is why Python is probably never moving to v4 unless they need to make some kind of huge change. Rust is an outlier with year-based versions. I guess that’s fine, but doesn’t tell you anything like a proper semantic versioning could.

Finally, I know that Rust is the newest of all the programming languages I’ve learned, but I really love how new projects are started. Python isn’t horrible, but it’s currently suffering from a lots of ideas, none of which has complete market share. You could do a simple virtual environment or you could do a more complex virtual environment/lock file situation with Poetry. (And there are about another half dozen variations on these two themes) But Rust….Rust deserves a chef’s kiss. When you start a new project with “cargo new project-name”, not only does it set up your directory structure, but it does a whole bunch of great setup tasks. It creates your Cargo.toml file (with Python, which only really started supporting toml files at the project level a few years ago, you need to look at documentation to figure out what goes in there) so that you have all the basics in there already. But it doesn’t stop there! It also, in a nod to modern programming, creates a git repository AND a gitignore file. It’s a thing of beauty. I would absolutely love for Python to move in this direction officially (not through a random user choice) for their defaults. Even “go mod init” could benefit from setting up a git repo and a git ignore (since the toml is not how Go works – I think they would probably best set up a README.md since Go’s default packaging is through git repos).

#Go #Golang #perl #python #Ruby #rust

https://wp.me/p5cs3g-4HT

ology, to random
@ology@fosstodon.org avatar

Woo! My two #perl talks, on beginning and advanced algorithmic music creation, for the upcoming conference in Vegas, #TPRC, were both accepted! :D

kennwhite, to random

Incredible research at BlackHat Asia today by Tong Liu and team from the Institute of Information Engineering, Chinese Academy of Sciences (在iie.ac.cn 的电子邮件经过验证)

A dozen+ RCEs on popular LLM framework libraries like LangChain and LlamaIndex - used in lots of chat-assisted apps including GitHub. These guys got a reverse shell in two prompts, and even managed to exploit SetUID for full root on the underlying VM!

image/jpeg
image/jpeg

mjgardner, (edited )
@mjgardner@social.sdf.org avatar

@kennwhite Looks like we’re at the “Matt’s Script Archive” level with frameworks.

The difference is that Matt Wright was a high school student in 1995 when he launched MSA and its infamously exploitable FormMail script.

ChristosArgyrop, to hpc
@ChristosArgyrop@mstdn.science avatar

One of the mainstream testing systems for high performance computing is written in @Perl

https://sourceforge.net/projects/ctsproject/

mjgardner, (edited )
@mjgardner@social.sdf.org avatar

@deflarerOfClouds has hosted development for a long time. Please continue to file bug reports there: https://GitHub.com/perltidy/perltidy/issues

You might even consider making a reasonable case to move the project’s remaining assets off . Impotently whinging about it here doesn’t change anything.

/ @ChristosArgyrop @ovid @perl

  • All
  • Subscribed
  • Moderated
  • Favorites
  • megavids
  • thenastyranch
  • rosin
  • GTA5RPClips
  • osvaldo12
  • love
  • Youngstown
  • slotface
  • khanakhh
  • everett
  • kavyap
  • mdbf
  • DreamBathrooms
  • ngwrru68w68
  • provamag3
  • magazineikmin
  • InstantRegret
  • normalnudes
  • tacticalgear
  • cubers
  • ethstaker
  • modclub
  • cisconetworking
  • Durango
  • anitta
  • Leos
  • tester
  • JUstTest
  • All magazines