Next:
Text::Wigwam::Library::Iterators
Previous:
Text::Wigwam::Library::Debug
 [Table of Contents][Text::Wigwam Index]

Text::Wigwam::Library::Filter



NAME

Text::Wigwam::Library::Filter #eat #format, #indent

Description

This library provides filter directives.

Usage

The directives within this library can be imported into specific branches of the directive tree (which transcends from Text::Wigwam::Directives) via plug-ins or modules using one of the following techniques.

 package Text::Wigwam::Directives::some::arbitrary::branch;
 # import everything
 use Text::Wigwam::Library::Filter qw/:all/;

 package Text::Wigwam::Directives::another::arbitrary::branch;
 # import selectively
 use Text::Wigwam::Library::Filter qw/ :indent /;

Directives

#eat expr

Eats the resulting value of expr. Useful for destroying a return value which you don't want output into the template. EXPR types will not be executed, as it uses the ANY context to execute its argument.

 [!!
  /* All examples herein produce no output */
  #eat "Your words"

  /*
    The following produces no output, and the "foo" template does not execute.
    This is probably not what was intended.
  */
  #eat #template "foo"

  /* executes the "foo" template, but produces no output */
  #eat #call #template "foo" () 
 !!]

#format string1 string2

Formats a block of text specified by string2 using sprintf style format specified by string2.

 [!!
    #format '%04d' ~!>
        0
        10
        200
        3000
    <!~
    /*
     0000
     0010
     0200
     3000
    */
 !!]

#indent num string

Indents a block of text specified by string by num spaces.

 [!!
  #indent 4 "Your words"
  /*
    Your words
  */
 !!]