PerlReq::Utils(3pm)

πŸ’– PerlReq::Utils πŸ’–

okay bestie, so this is PerlReq::Utils, and it lives in section 3pm of the manual (that's the "User Contributed Perl Documentation" shelf, iykyk). Think of it as the little helper drawer that B::PerlReq, perl.req and perl.prov all raid when they need something done. It's giving backstage crew energy β€” never in the spotlight, always holding the whole show up. πŸ‘‘


✨ NAME ✨

PerlReq::Utils β€” all the auxiliary routines for B::PerlReq, perl.req and perl.prov. Little sidekick functions, big main character job. 🫢


🌸 DESCRIPTION 🌸

This module hands you the following convenience functions, and honestly? They're all pretty iconic in their own lowkey way:

  • path2mod β€” turns a file path into a module name. So like, File/Find.pm becomes File::Find. Slashies out, colons in, periodt. πŸ’…
  • mod2path β€” the exact opposite glow-up: module name to file path. File::Find becomes File/Find.pm. πŸ¦‹
  • path2dep β€” converts a file path into the conventional dependency name. So File/Find.pm becomes perl(File/Find.pm). Not me β€” heads up though, this is different from the RedHat conventional form perl(File::Find). Don't get it twisted bestie. 😭
  • mod2dep β€” converts a module name into the conventional dependency name. File::Find becomes perl(File/Find.pm). And yeah, same disclaimer: this differs from the RedHat conventional form perl(File::Find). πŸŽ€
  • verf β€” formats a module version number. Like 2.12 becomes 2.120. Currently it truncates to 3 digits after the decimal point, except when it's all zeroes β€” e.g. 2.000 becomes 2.0. πŸ’€

Update: the algorithm got amended in an almost compatible way so that versions don't lose precision when they get truncated. Now it allows one more .ddd series at the end, but .000 is still truncated by default. For example: 2.123 becomes 2.123, and 2.123456 becomes 2.123.456. Look at her go. ✨

  • verf_perl β€” formats a Perl version number, e.g. 5.005_03 becomes 1:5.5.30. πŸ”₯
  • sv_version β€” extracts the version number from a B::SV object. v-strings get converted to floats according to Perl rules, e.g. 1.2.3 becomes 1.002003. 🌈
  • argv β€” grabs you a list of files passed on the command line. When the command line is empty, it gets the list from standard input instead, one file per line. It dies when the file list is empty, and it checks that every single file actually exists β€” otherwise, die again. πŸ’€ Each filename gets canonicalized with the File::Spec::rel2abs() function (which, mind you, makes no checks against the filesystem). So it's trusting, but also not naive. Vibe check passed. πŸ“
  • inc β€” gets you a list of Perl library paths from the @INC variable, except for the current directory. The RPM_PERL_LIB_PATH environment variable, if it's set, gets treated as a list of paths separated by colons, and those paths get put in front of the list. Then every path in the list gets canonicalized.

Finally, the RPM_BUILD_ROOT environment variable, if set, is treated as the installation root directory β€” each element of the list gets prefixed with the canonicalized RPM_BUILD_ROOT path, and those new values go in front of the list. πŸ“š

And after ALL of that? Only the existent directories are returned. Only the real ones make the cut. πŸ‘‘

  • explode β€” splits a given filename into its prefix (which is a valid Perl library path, according to the inc() function up above) and its basename. If the filename doesn't match any prefix, it returns an empty list. Sorry babe, nothing for you. πŸ™ˆ

πŸ‘‘ AUTHOR πŸ‘‘

Written by Alexey Tourbin <at@altlinux.org>. Give credit where credit is due, fr fr. 🫢


πŸ’œ COPYING πŸ’œ

Copyright (c) 2004 Alexey Tourbin, ALT Linux Team.

This is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Slay, legally speaking. βš–οΈβœ¨


🌟 SEE ALSO 🌟

  • B::PerlReq
  • perl.req
  • perl.prov

and that's the whole page bestie, no cap. this manual page is from perl v5.42.3, dated 2026-08-19, and it's filed under PerlReq::Utils(3pm) β€” go forth and canonicalize something. πŸ’–πŸ¦‹πŸ’…

πŸ“¦ where this page comes from