Enable dist::metadata for a data structure
version 0.925
my $dm = Dist::Metadata->new(struct => { files => { 'lib/Mod.pm' => 'package Mod; sub something { ... }', 'README' => 'this is a fake dist, useful for testing', } });
This is a subclass of Dist::Metadata::Dist to enable mocking up a dist from perl data structures.
This is mostly used for testing but might be useful if you already have an in-memory representation of a dist that you'd like to examine.
It's probably not very useful on it's own though, and should be used from \*(L"new\*(R" in Dist::Metadata.
$dist = Dist::Metadata::Struct->new(files => { 'lib/Mod.pm' => 'package Mod; sub something { ... }', });
Accepts a \*(C`files\*(C' parameter that should be a hash of \*(C`{ name => content, }\*(C'. Content can be a string, a reference to a string, or an \s-1IO\s0 object.
\*(C`Unix\*(C' is the default for consistency/simplicity but \*(C`file_spec\*(C' can be overridden in the constructor.
Returns the string content for the specified name.
Returns the keys of the \*(C`files\*(C' hash.
Randy Stauner <[email protected]>
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.