Next:
Text::Wigwam::Library::Time
Previous:
Text::Wigwam::Library::Struct
 [Table of Contents][Text::Wigwam Index]

Text::Wigwam::Library::System



NAME

Text::Wigwam::Library::System #escape_var, #get_options, #module, #plugin

Description

This library provides directives which are useful for performing system related functions.

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::System qw/:all/;

 package Text::Wigwam::Directives::another::arbitrary::branch;
 # import selectively
 use Text::Wigwam::Library::System qw / :escape_var :get_options :module /;

Directives

#module list

Loads a list of modules specified in list, or throws an exception if any of the specified modules fail to load. The recommended method for loading modules is via the Embedded parsing options, however this directive is provided for those instances where modules are to be loaded conditionally.

 [!!
  /* Find and load modules Foo and Bar from within the module path */
  #if foobar {
   #try #module ( 'Foo' 'Bar' )
   #catch #throw "Failed to load required modules" /* custom error msg */
  }
 !!]

#plugin list

Loads a list of plugins specified in list, or throws an exception on error. The recommended method for loading plugins is via the Embedded parsing options.

sub _proto_plugin { [ ARRAY ] } sub _plugin { my $err = $_[0]->load_plugins( @{$_[0]->get_arg} ); $_[0]->exception( $err ) if $err; return; }

#get_options

Returns a copy of the configuration options hash.

 [!!
  #define options #get_options
  "The current parsing engine is: " options.engine
 !!]

#escape_var var

Returns a copy of var with any meta characters escaped so that it may be used to access variables that contain meta characters. This is typically used when dealing with hash keys which are then used to look up values.

 [!!
  #define hashvar %(  'silly.key' 'silly' '[wacky]key' 'wacky!' )
  #foreach key #keys hashvar {
   #define ekey #escape_var key
  !!>
   Pair: [!! key !!] = [!! hashvar.[ekey] !!]
  <!~
  }
  /* output:
   Pair: silly.key = silly
   Pair: [wacky]key = wacky!
  */
 !!]