The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

File::ANVL - routines to support A Name Value Language, version 0.1

SYNOPSIS

 use File::ANVL;           # to import routines into a Perl script

 $elem = anvl_fmt( $label, $string );
                            # Wraps text to 72 columns, appends newline
                            # to end the value.  Trims whitespace from
                            # $string but preserves initial newlines and
                            # internal newlines.

 # Example of anvl_fmt() to make an ERC with Dublin Kernel metadata.
 $anvl_record = anvl_fmt("erc")
     . anvl_fmt("who", $creator)
     . anvl_fmt("what", $title)
     . anvl_fmt("when", $date)
     . anvl_fmt("where", $identifier)
     . "\n";                # 2nd newline in a row terminates ANVL record

 anvl_split( $record,       # Splits ANVL record into an array of elems
             $elemsref,     # as name/value pairs.  Optional bpoolean 3rd
             $strict )      # arg rejects unindented continuation lines
                            # (default 0).  Returns empty string on
                            # success, or message beginning "warning:..."
                            # if a recoverable formatting problem was
                            # corrected.  A reference to array of broken
                            # out elements is returned through $elemsref.

 # Example use of anvl_split() to extract first element.
 ($msg = anvl_split($record, $elemsref)
     and die("anvl_split: $msg);        # report what went wrong
 print scalar($$elemsref), " elements found\n"
     "First element label is $$elemsref[0]\n",
     "First element value is $$elemsref[1]\n";

DESCRIPTION

This is very brief documentation for the ANVL Perl module, which deals with routines for representing data or metadata values in two very simple forms. ANVL (A Name Value Language) is label-colon-value format similar to email headers.

The anvl_fmt() function returns a plain text string (in label-colon-value format) representing an anvl element. Its main purpose is to URL-encode (%-encode) the label and wrap lines for convenient printing and screen viewing. Newlines in the value are preserved.

SEE ALSO

A Name Value Language (ANVL) http://www.cdlib.org/inside/diglib/ark/anvlspec.pdf

A Metadata Kernel for Electronic Permanence (PDF) http://journals.tdl.org/jodi/article/view/43

HISTORY

This is an alpha version of ANVL tools. It is written in Perl.

AUTHOR

John A. Kunze jak at ucop dot edu

COPYRIGHT AND LICENSE

Copyright 2009 UC Regents. Open source Apache License, Version 2.

PREREQUISITES

Perl Modules: Text::Wrap

Script Categories:

UNIX : System_administration