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

NAME

Decl::Util - some utility functions for the declarative framework - automatically included for generated code.

VERSION

Version 0.01

SYNOPSIS

This class is a lightweight set of utilities to make things easier throughout Decl. I'm not yet sure what will end up here, but my rule of thumb is that it's extensions I'd like to be able to use in code generators as well.

Lazy Lispy lists: car(), cdr(), popcar(), splitcar()

I like Higher-Order Perl, really I do - but his head/tail streams are really just car and cdr, so I'm hereby defining car and cdr as lazy-evaluated streams throughout the language. Nodes are arrayrefs. Clean and simple, no object orientation required.

lazyiter($iterator)

Takes any coderef (but especially an Iterator::Simple) and builds a stream out of it. Invokes the coderef once to get the first value in the stream.

escapequote($string, $quote)

Returns a new string with $quote escaped (by default, '"' is escaped) by means of a backslash.

Hierarchical values a la CSS: hh_set(hash, name, value), hh_get (hash, name), and prepare_hierarchical_value as a helper

You know how CSS lets you specify something like font-size: 8 as well as something more like font: {size: 8}? These functions give you something similar using hierarchically nested hashrefs. They allow you to mix types of addressing:

   hh_set($h, 'border-left', 'my value');
   hh_set($h, 'border', 'right: val1; top: val2');
   
   # { 'border' => {'left'  => 'my value',
   #                'right' => 'val1',
   #                'top'   => 'val2'
   #               }
   # }
   

Clear? Then you can use hh_get to retrieve 'border' or 'border-left' by digging down into the hashref hierarchy.

Separators for names can be anything in -./

AUTHOR

Michael Roberts, <michael at vivtek.com>

BUGS

Please report any bugs or feature requests to bug-decl at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Decl. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

LICENSE AND COPYRIGHT

Copyright 2010 Michael Roberts.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.