Jonathan Kamens 86 47 on Nostr: Every once in a while I'm just flabbergasted by how bad #Perl error-handling is, or ...
Every once in a while I'm just flabbergasted by how bad #Perl error-handling is, or at least old-style error-handling before Perl's version of exceptions started to catch on.
Like, the "messages" method of a "Mail::IMAPClient" object returns an empty list if there are no messages to fetch, but it returns undef (a scalar, not a list) if there was an error, so you can't just do "!@msgs" to check for an error, you have to do "@msgs==1&&!defined($msgs[0])". Ridiculous.
#programming
Published at
2025-07-27 15:02:19 UTCEvent JSON
{
"id": "5a5c877e43954b7b033e01edb4997cc500007b537b70feb7a8c5aaaaac661126",
"pubkey": "14ef91be93dec761b82ea32ac9d9e2f7198a6de4be9f240b765f3dccfbef8b45",
"created_at": 1753628539,
"kind": 1,
"tags": [
[
"t",
"programming"
],
[
"proxy",
"https://federate.social/@jik/114925799939929901",
"web"
],
[
"t",
"perl"
],
[
"proxy",
"https://federate.social/users/jik/statuses/114925799939929901",
"activitypub"
],
[
"L",
"pink.momostr"
],
[
"l",
"pink.momostr.activitypub:https://federate.social/users/jik/statuses/114925799939929901",
"pink.momostr"
],
[
"-"
]
],
"content": "Every once in a while I'm just flabbergasted by how bad #Perl error-handling is, or at least old-style error-handling before Perl's version of exceptions started to catch on.\nLike, the \"messages\" method of a \"Mail::IMAPClient\" object returns an empty list if there are no messages to fetch, but it returns undef (a scalar, not a list) if there was an error, so you can't just do \"!@msgs\" to check for an error, you have to do \"@msgs==1\u0026\u0026!defined($msgs[0])\". Ridiculous.\n#programming",
"sig": "4cd4e172b4cc2570f72d95ca46abcef47f32d8d153825c45349499a94c8d1bab6a529283d5a55d32b46c02a9f2f22054e8d0bd4e071739daff81a77c8430234c"
}