Dist::Metadata::Struct(3pm)

Dist::Metadata::Struct3pm

Enable dist::metadata for a data structure

Usage

  my $dm = Dist::Metadata->new(struct => {
    files => {
      'lib/Mod.pm' => 'package Mod; sub something { ... }',
      'README'     => 'this is a fake dist, useful for testing',
    }
  });

Version

version 0.927

Overview

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 "new" in Dist::Metadata.

Methods

new

  $dist = Dist::Metadata::Struct->new(files => {
    'lib/Mod.pm' => 'package Mod; sub something { ... }',
  });

Accepts a "files" parameter that should be a hash of "{ name => content, }". Content can be a string, a reference to a string, or an IO object.

default_file_spec

"Unix" is the default for consistency/simplicity but "file_spec" can be overridden in the constructor.

file_content

Returns the string content for the specified name.

find_files

Returns the keys of the "files" hash.

Releases

7 releases since Debian 7 (Wheezy); the text changed 4 times.

  1. 7
  2. 8
  3. 9–10
  4. 11
  5. 12–13

Author

Randy Stauner <[email protected]>

From libdist-metadata-perl 0.927-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.