The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::FCP::Metadata - metadata utility class.

SYNOPSIS

 use Net::FCP::Metadata;

DESCRIPTION

$metadata = new Net::FCP::Metadata [$string_or_object]

Creates a new metadata Object from the given string or reference. The object is overloaded and will stringify into the corresponding string form (which might be slightly different than the string it was created from).

If no arguments is given, creates a new metadata object with just a version part.

The object is implemented as a hash reference. See parse_metadata, below, for info on it's structure.

$metadata->as_string

Returns the string form of the metadata data.

$metadata->add_redirect ($name, $target[ info1 => arg1...])

Add a simple redirection to the document section to the given target. All extra arguments will be added to the info subsection and often contains description and format fields.

$meta = Net::FCP::Metadata::parse_metadata $string

Internal utility function, do not use directly!

Parse a metadata string and return it.

The metadata will be a hashref with key version (containing the mandatory version header entries) and key raw containing the original metadata string.

All other headers are represented by arrayrefs (they can be repeated).

Since this description is confusing, here is a rather verbose example of a parsed manifest:

   (
      raw => "Version...",
      version => { revision => 1 },
      document => [
                    {
                      info => { format" => "image/jpeg" },
                      name => "background.jpg",
                      redirect => { target => "freenet:CHK\@ZcagI,ra726bSw" },
                    },
                    {
                      info => { format" => "text/html" },
                      name => ".next",
                      redirect => { target => "freenet:SSK\@ilUPAgM/TFEE/3" },
                    },
                    {
                      info => { format" => "text/html" },
                      redirect => { target => "freenet:CHK\@8M8Po8ucwI,8xA" },
                    }
                  ]
   )
$string = Net::FCP::Metadata::build_metadata $meta

Internal utility function, do not use directly!

Takes a hash reference as returned by Net::FCP::parse_metadata and returns the corresponding string form. If a string is given, it's returned as is.

SEE ALSO

Net::FCP.

BUGS

Not heavily tested.

AUTHOR

 Marc Lehmann <schmorp@schmorp.de>
 http://home.schmorp.de/