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

NAME

fv2xml - convert a Tie::FieldVals datafile into XML data.

VERSION

This describes version 0.6202 of fv2xml.

SYNOPSIS

fv2xml --help | --manpage | --version

fv2xml { --match field=pattern } [ --match_any pattern ] [ --num_recs num ] [ --start_rec num ] { --sort_by field } { --sort_numeric field } { --sort_reversed field } datafile [ outfile ]

DESCRIPTION

This script converts a (subset of) a Tie::FieldVals datafile into XML data.

OPTIONS

--datafile filename

The input data file (in Tie::FieldVals format).

--help

Print help message and exit.

--manpage

Print the full help documentation (manual page) and exit.

--match field=pattern

Extract a subset of records from the file, by only including those which match the given pattern for the given field. This option can be repeated for multiple fields. For example:

    --match Author=Mary

will give the records for authors which contain the string "Mary".

--match_any pattern

Extract a subset of records from the file by only including those which match the given pattern in any field.

--num_recs n

Extract a subset of at most n records from the collection (it may be less).

--sort_by field

Sort by this field. Can be repeated to sort by multiple fields. Thus, if one wished to sort by Author and then Title, one would give:

    --sort_by Author --sort_by Title
--sort_numeric field

If sorting by this field, use this to alter the type of the sort, to make it numeric.

For example:

    --sort_by SeriesOrder --sort_numeric SeriesOrder

To switch off numeric sort for a field, give the value of 0 to the argument.

For example: --sort_by SeriesOrder --sort_numeric SeriesOrder=0

--sort_reversed field

If sorting by this field, use this to alter the direction of the sort, to make it sort reversed.

For example: --sort_by Author --sort_reversed Author

To switch off reversed sort for a field, give the value of 0 to the argument.

For example: --sort_by Author --sort_reversed Author=0

--start_rec n

Extract a subset of records starting from the nth record.

--verbose

Print informational messages.

--version

Print version information and exit.

FILE FORMATS

FieldVals Format

The input data file is in the form of Field:Value pairs, with each record separated by a line with '=' on it.

See "FILE FORMAT" in Tie::FieldVals for more information.

XML FORMAT

The format of the output XML file is as follows:

    <fv_data>
        <record>
           <Field>Value</Field>
            <AnotherField>AnotherValue</AnotherField>
            ...
        </record>
        ...
    </fv_data>

Each field name is given its own tag, and the element contains the value for that field.

REQUIRES

    Getopt::Long
    Pod::Usage
    Getopt::ArgvFile
    Data::Dumper
    Tie::FieldVals
    Tie::FieldVals::Row
    Tie::FieldVals::Select

SEE ALSO

perl(1) Getopt::Long Getopt::ArgvFile Pod::Usage

BUGS

Please report any bugs or feature requests to the author.

AUTHOR

    Kathryn Andersen (RUBYKAT)
    perlkat AT katspace dot com
    http://www.katspace.com

COPYRIGHT AND LICENCE

Copyright (c) 2004 by Kathryn Andersen

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.