IM::Address(3pm)
π IM::Address π
okay bestie, so this is a page from the Internet Message Perl modules set, and it's filed under manual name IM::Address (section 3pm, if you're keeping track). it's a whole module. it parses addresses. let's GO π¦
β¨ NAME β¨
IM::Address β RFC822 style address parser
like, it takes email-ish addresses that are all dressed up in comments and display names, and it finds the actual address hiding underneath. no cap. π
πΈ SYNOPSIS πΈ
here's the vibe, bestie β copy these exactly:
use IM::Address;
$pure_address_portion = &extract_addr($address_with_comment);
$replaced_address = &replace_addr($original_address_with_comment,
$pure_notation_of_old_address, $pure_notation_of_new_address);
($first, $rest) = &fetch_addr($address_list, $pure_address_flag);
three little functions, three little jobs. iconic behavior honestly π
π DESCRIPTION π
so, the tea: the IM::Address module is a parser for RFC822 style address. that's the whole thing. it parses them. beautifully. π
and this module is provided by IM (Internet Message). that's the family it belongs to, and we love her for it π«Ά
π EXAMPLES π
okay these are the fun part, let's run through them:
- first one: with
$a = "Motonori Nakamura <motonori\@econ.kyoto-u.ac.jp>";
then &extract_addr($a) returns "motonori@econ.kyoto-u.ac.jp".
see what happened?? it extracted just the pure address out of the whole decorated string. the name and the angle brackets got left behind. so clean β¨
- second one: with
$a = "Motonori Nakamura <motonori\@econ.kyoto-u.ac.jp>";
$b = "motonori\@econ.kyoto-u.ac.jp";
$c = "motonori\@wide.ad.jp";
then &replace_addr($a, $b, $c) returns "Motonori Nakamura <motonori@wide.ad.jp>".
so it found $b inside $a, swapped in $c, and kept the original pretty formatting around it. the display name stayed. the angle brackets stayed. only the address itself changed. that's the whole point and it ATE π₯
- third one: with
$a = "kazu, nom, motonori";
then &fetch_addr($a, 0) returns ("kazu", " nom, motonori").
note the space in front of " nom, motonori" β that's not a typo, that's literally what it returns, so don't come for me π it pulled off the first address in the list and handed you back the rest, comma-and-space intact.
π COPYRIGHT π
IM (Internet Message) is copyrighted by the IM developing team. you can redistribute it and/or modify it under the modified BSD license. see the copyright file for more details. π
and that's the whole page bestie!! π
this beauty is version IM153, dated 2016-10-10 β so yeah, she's been serving since 2016 and she's still out here parsing. mwah. take care of her, and remember: extract, replace, fetch, slay β¨π¦π
π¦ where this page comes from
- debian bookworm: im 1:153-4 Β· BSD-3-Clause
- debian trixie: im 1:153-4 Β· BSD-3-Clause
- ubuntu jammy: im 1:153-4 Β· BSD-3-Clause
- ubuntu noble: im 1:153-4 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms