String::Dirify(3pm)
π String::Dirify π
okay bestie so this is String::Dirify β a User Contributed Perl Documentation page, and it's literally about turning a string into a directory name. that's the whole vibe. π
β¨ NAME β¨
String::Dirify β Convert a string into a directory name πΈ
β¨ Synopsis β¨
use String::Dirify;
my($dir_1) = String::Dirify -> dirify('frobnitz');
Or:
use String::Dirify ':all';
my($dir_2) = dirify('bar baz');
Or even:
use String::Dirify;
my($sd) = String::Dirify -> new();
my($dir_3) = $sd -> dirify('!Q@W#E$R%T^Y');
three ways, all iconic, pick your fighter π«Ά
β¨ Description β¨
String::Dirify is a pure Perl module. no cap. π
what it does: it takes a string β possibly one that's full of high ASCII characters, and maybe even HTML?? yeah it can handle that too β and converts it into another string, this one lower-cased, that you can actually use as a directory name. it's giving "cleanup crew" energy. π§
for usage, see the Synopsis up there (yes, literally go look at it, i already wrote it out).
this code is derived from similar code in Movable Type. π¦
β¨ Method: dirify($string [, $separator]) β¨
returns a string, which you can use as a directory name.
the default separator is '_'.
each run of spaces in the string gets replaced by this separator. every. single. run. π
β¨ Algorithm β¨
- Each high ASCII character is replaced by its normal equivalent
- The string is converted to lower case
- Any HTML (including HTML entities) in the string is removed
- Any characters which are not (Perl) words, spaces or hyphens, are removed
- Runs of spaces are converted to the separator character For more details about this character, see the discussion of the
dirify()method (above). π
β¨ Melody 'v' Movable Type β¨
See <https://openmelody.org> for details. π
β¨ Backwards Compatibility with Movable Type β¨
okay so this part is lowkey cursed, brace yourself. π
unfortunately β and i mean unfortunately β the way Movable Type uses dirify() allows a fake separator β '1' β to be used for the second parameter in the call to dirify().
the '1' triggered usage of '_' as the separator, rather than the '1' you actually provided. yes fr fr, your 1 gets ignored and you get an underscore. π
this'feature'has been preserved inString::Dirify, but is discouraged. instead, just drop the second parameter entirely and let the code default to'_'. do that. please. for me. π₯Ί
β¨ Distributions β¨
this module is available as a Unix-style distro (*.tgz). π¦
See <https://savage.net.au/Perl-modules.html> for details.
β¨ REPOSITORY β¨
<https://github.com/ronsavage/String-Dirify> β go star it bestie β
β¨ Authors β¨
String::Dirify started out as part of the Movable Type code. π
then, Mark Stosberg cut down the original code to provide just the English/ISO/ASCII features. βοΈ
lastly, the code was cleaned up, tests added, and all packaged, by Ron Savage <ron@savage.net.au> in 2009. π
Homepage: <https://savage.net.au/index.html>
β¨ Copyright β¨
Copyright (c) 2009, Mark Stosberg, Ron Savage.
Copyright (c) 2010, 2011, Ron Savage.
and that's the whole page, bestie!! this was perl v5.36.0, dated 2022-10-13, straight from the String::Dirify(3pm) manual β slay, go dirify something, periodt π
β¨
π¦ where this page comes from
- ubuntu noble: libstring-dirify-perl 1.03-3 Β· Artistic-1.0-Perl
- ubuntu resolute: libstring-dirify-perl 1.03-3 Β· Artistic-1.0-Perl
- ubuntu stonking: libstring-dirify-perl 1.03-3 Β· Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms