MMAgic.pl File Reference

MMAgic.pl - Demonstrate use of various MMAgic packages. More...

Go to the source code of this file.

Functions

 process ($data, $stream)
 Recursively process the data object to generate WDDX output.

Detailed Description

MMAgic.pl - Demonstrate use of various MMAgic packages.

SYNOPSIS

  usage: MMAgic.pl <flag>* <file>
  <flag>
      --curse         # cause endless recursion in process() function
      --show          # show object parsed from input file before conversion
      --trace=<tag>   # trace processing for SUBS and/or DETAIL
                      #   (can be used multiple times)

DESCRIPTION

Simple program to convert a configuration file in Perl data structure code into WDDX (XML data exchange format) format.

The real purpose of this script is to demonstrate the use of selected MMAgic libraries from my personal toolkit.

MMAgic::Data
Loads data from a file that written in Perl data structure syntax. This is done by simply evaluating the contents of the file using the Perl interpreter. The Safe module is used to lock down the kinds of operations that the interpreter will parse, in an attempt to make this mechanism safe.
MMAgic::Log
Tagged log statements in a consistent format. Uses indentable output stream to show stack depth context of log statements. Provides data dump formats and subroutine information as required.
MMAgic::Output
Indentable output stream used by Log.pm. Also used to generate nicely formatted WDDX output in this example.
MMAgic::Trace
Filter-based trace mechanism. When disabled, trace statements are merely comments, so there is no run-time penalty.

EXAMPLES

  MMAgic.pl                                        # usage message
  MMAgic.pl demo/book.data                         # working example
  MMAgic.pl demo/time.data                         # bad data file error
  MMAgic.pl demo/oops.data                         # non-existent data file
  MMAgic.pl demo/book.data --trace=SUBS            # see trace statements
  MMAgic.pl demo/book.data --trace=SUBS --trace=DETAIL
  MMAgic.pl demo/book.data --trace=SUBS --curse    # endless recursion

COPYRIGHT AND LICENSE

Copyright 2004-2008 by Marc M. Adkins

Author:
Marc M. Adkins, mailto:Perl@Doorways.org

Definition in file MMAgic.pl.


Function Documentation

process ( data,
stream 
)

Recursively process the data object to generate WDDX output.

Parameters:
$data Data structure from which to generate WDDX output.
$stream MMAgic::Output stream on which to generate WDDX output