YAML is a data-centric markup language that relies on ASCII symbols such as hyphens, question marks, colons and commas to construct data blocks (scalar values or hashes). Like XML, YAML is machine-readable and can easily be integrated with scripting languages such as Perl. Here are 10 of the more useful CPAN YAML development modules.
This article is also available as a TechRepublic download.
Most people have heard of XML, but not as many have heard of YAML, which is a retronym for "YAML Ain't Markup Language". YAML is a data-centric markup language that relies on ASCII symbols such as hyphens, question marks, colons and commas to construct data blocks (scalar values or hashes). Like XML, YAML is machine-readable and can easily be integrated with scripting languages...and one of those scripting languages just happens to be Perl.
If you're interested in using YAML in your Perl application, though, you don't need to write a parser from scratch. CPAN, the Comprehensive Perl Archive Network, is packed to the brim with all manner of YAML goodies for Perl programmers. And this document lists the ten most useful ones for YAML development. (Table A)
Note: You can install CPAN modules directly from the Internet, by following the instructions provided.
This module provides an object-oriented interface to serializing Perl objects to YAML and vice-versa. It includes both a loader and a dumper, and can be used to load a stream of YAML documents into a Perl script, or convert Perl data structures into a YAML document.
Use this module when you need to (de)serialize Perl data structures to YAML.
This module is useful for working with YAML document streams using an object-oriented approach. It is particularly good for incrementally or concurrently reading and writing multiple YAML documents within a single script.
Use this module when you need to read or write YAML document streams.
This module lets you directly specify YAML markup in a Perl script, using filtering methods to convert this markup into Perl data structures.
Use this module to easily describe large and static Perl data structures in YAML.
This module provides a "tiny" implementation of the full YAML specification, making it possible to write more efficient YAML-based applications that have lower overhead and smaller memory footprints.
Use this module when you need a small-footprint application without necessarily complete YAML functionality.
This module provides an object-oriented approach to managing configuration files in Perl. It uses YAML to express configuration directives, and supports both per-directory and global configuration files.
Use this module when you need to create or manipulate configuration files in Perl.
This module provides functions to convert a YAML document into an HTML page, or to dynamically build and write an HTML document from YAML markup.
Use this module when you need a quick-and-dirty way to convert YAML markup into HTML.
This module lets you store CGI session data in a YAML container, and provides deserialization methods to access it both from Perl and other languages.
Use this module if you need to construct a custom data storage container for your session-based application.
This module provides a simple caching framework for a Web site. It allows you to cache the output of scripts and function calls as YAML, and reduce response times by rendering the cached pages to clients.
If your site receives a lot of traffic, use this module to reduce server load and page processing time by occasionally providing clients with snapshots from the page cache instead of the "live" page.
This module provides a unique way to combine Perl application logic with the simplicity of YAML structures, by providing a framework to nest structures and logic.
Use this module when you want to embed business logic into a data structure, to create reusable objects that can be transferred across applications.
This module provides a framework for you to test YAML class implementations. It is particularly good at building reusable data driven patterns.
Use this module when you need to build a testing framework for YAML-based Perl applications.