Apache2::WebApp::Helper - Base class for command-line script functionality


Apache2-WebApp-Toolkit documentation  | view source Contained in the Apache2-WebApp-Toolkit distribution.

Index


NAME

Top

Apache2::WebApp::Helper - Base class for command-line script functionality

SYNOPSIS

Top

  use Apache2::WebApp::Helper;

  my $obj = Apache2::WebApp::Helper->new;

DESCRIPTION

Top

Base class module that implements a constructor and provides helper script functionality for writing template output to a file.

OBJECT METHODS

Top

set_vars

Set the template object attributes.

  $obj->set_vars(\%vars);

write_file

Write the template output to a file.

  $obj->write_file($file, $output);

get_source_path

Returns the path to the /webapp-toolkit source directory.

  $self->get_source_path();

error

Print errors/exceptions to STDOUT and exit.

  $self->error($mesg);

EXAMPLES

Top

Template to file processing

SCRIPT

  use Apache2::WebApp::Helper;

  my $obj = Apache2::WebApp::Helper->new;

  $obj->set_vars(
      {
          foo => 'bar',
          baz => qw( bucket1 bucket2 bucket3 ),
          qux => qw{
                     key1 => 'value1',
                     key2 => 'value2',
                     ...
                  },
          ...
       }
    );

  # program continues...

  $obj->write_file('/path/to/infile.tt','/path/to/outfile.txt');

TEMPLATE

  [% foo %]

  [% FOREACH bucket = bar %]
      [% bucket %]
  [% END %]

  [% qux.key1 %]
  [% qux.key2 %]

SEE ALSO

Top

Apache2::WebApp, Apache2::WebApp::AppConfig, Apache2::WebApp::Template

AUTHOR

Top

Marc S. Brooks, <mbrooks@cpan.org> http://mbrooks.info

COPYRIGHT

Top


Apache2-WebApp-Toolkit documentation  | view source Contained in the Apache2-WebApp-Toolkit distribution.