Dist::...Struct(3pm)
π Dist::...Struct π
okay so bestie, you know how this is a page from the User Contributed Perl Documentation section of the manual β the Dist::...Struct(3pm) one β and it's literally all about letting Dist::Metadata vibe with a plain old data structure instead of an actual dist sitting on your disk? yeah. that's the whole thing. let's get into it π«Ά
β¨ NAME β¨
Dist::Metadata::Struct β it's giving "enable Dist::Metadata for a data structure". that's it, that's the name. no cap.
πΈ VERSION πΈ
version 0.927 β yes, the good version, the one you're looking at right now π
π SYNOPSIS π
my $dm = Dist::Metadata->new(struct => {
files => {
'lib/Mod.pm' => 'package Mod; sub something { ... }',
'README' => 'this is a fake dist, useful for testing',
}
});
look at her go. a whole fake dist, conjured out of thin air, no filesystem required β¨
π¦ DESCRIPTION π¦
okay so this is a subclass of Dist::Metadata::Dist, and its entire job is enabling you to mock up a dist out of perl data structures. like, manifesting a dist but for real, in memory, no cap.
it's mostly used for testing β that's the main character use case β but lowkey it might also be useful if you already have an in-memory representation of a dist and you'd like to examine it. cute, right?
but listen. it's probably not very useful on it's own though, and you should really be using it from "new" in Dist::Metadata. don't come for me, that's just what the page says. use it through the parent, bestie.
π§ METHODS π§
new
$dist = Dist::Metadata::Struct->new(files => {
'lib/Mod.pm' => 'package Mod; sub something { ... }',
});
this accepts a files parameter, and that parameter should be a hash of { name => content, }. and the content? it can be a string, a reference to a string, or an IO object. three whole options, we love flexibility π«Ά
default_file_spec
"Unix" is the default for consistency/simplicity β keeping it simple, keeping it cute β but "file_spec" can be overridden in the constructor if you're feeling spicy. go off π
file_content
returns the string content for the specified name. that's the whole thing. it just hands you the content. iconic behaviour honestly.
find_files
returns the keys of the files hash. all of them. every single one. slay.
π AUTHOR π
Randy Stauner <rwstauner@cpan.org> β the author, the legend, the blueprint π
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2011 by Randy Stauner.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. fr fr, free as in do-whatever-the-perl-terms-say π
and that's the whole page, bestie!! πβ this was perl v5.34.0, dated 2022-06-13, and it lives at Dist::...Struct(3pm) in the User Contributed Perl Documentation. mwah π
π bye!! π¦
π¦ where this page comes from
- debian bookworm: libdist-metadata-perl 0.927-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libdist-metadata-perl 0.927-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libdist-metadata-perl 0.927-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libdist-metadata-perl 0.927-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdist-metadata-perl 0.927-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms