AMF::2ReDIF -- convert AMF::Record object to ReDIF::Record template object

- NAME
- SYNOPSIS
- DESCRIPTION
- SEE ALSO
- AUTHOR

# NAME

AMF::2ReDIF -- convert AMF::Record object to ReDIF::Record template object

# SYNOPSIS

      use AMF::Parser;
      use AMF::2ReDIF;

      ...
      $rec = amf_get_next_record;

      my $template = AMF::2ReDIF::translate( $rec );

      if ( $template ) {
        my $type   = $template -> {'template-type'}[0];
        my $handle = $template -> {handle}[0];
        ...

# DESCRIPTION

This module's only function for external consumption is `translate()`. It takes an AMF::Record object as an argument and returns a ReDIF::Record object. Returns undef if translation is impossible. ReDIF::Record object is template hash reference, blessed into ReDIF::Record class.

The AMF and ReDIF data models do not match, although overlap very much. Very likely the translation will loose some of the original AMF's information, which can't be represented in ReDIF terms.

So, this module is not supposed to work on 100% of your data. It will translate to ReDIF only ``reasonably well-behaved AMF'' and fail otherwise.

Also, we do not guarantee that the resulting template structure will be anything like the structure produced by ReDIF::Parser. The structure itself -- will be almost the same (but blessed into ReDIF::Record). Some technical rarely-used top-level elements will be absent (such as `FILENAME, STARTFPOS, START_LINE_NUMBER, ENCODING, REPORT, ERRORS, MESSAGES, WARNINGS, TEXT`). The AMF adjectives' values and identifiers are not checked equivalently to how ReDIF::Parser does that. It doesn't do all the checks that redif.spec does. Be warned.

One of the best ways to see this module in action and to see what exactly `translate()` function produces, is to use `amfch` utility with `-o` option on an AMF file.

# SEE ALSO

the ReDIF::Parser manpage, the ReDIF::Record manpage, the amfch manpage, the AMF::Record manpage, the AMF::Parser manpage

# AUTHOR

Ivan Kurmanov, http://www.ahinea.com/en/ for ACIS project, http://acis.openlib.org/