The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

BW::Include - Included File Processing

SYNOPSIS

  use BW::Include;

  $pf = new BW::Include;

  $pf = new BW::Include($filename);

  $pf = new BW::Include(DIR => $absolutepath)

  $pf = new BW::Include({
                   DIR => $absolutepath, 
                   FILENAME => $filename
                 })

ABSTRACT

Include perl objects in external files for processing the output of CGI and other perl programs.

METHODS

spf
   $pf->spf;
   $pf->spf($filename);

The spf method reads a file, performs the appropriate replacements, and returns the result. The file named in $filename is used, if provided.

pf
   $pf->pf;
   $pf->pf($filename);

The pf method calls spf and sends the result to STDOUT. The file named in $filename is used, if provided.

sps string

Performs replacements on a string instead of a file. Returns the results as a string.

var
   $pf->var($name);
   $pf->var($name, $value);

The var method sets or gets the value of a named variable. The variables are stored in a hash associated with the BW::Include object. If there is a value passed, the method sets the variable. The method always returns the value, if any.

OBJECT DATA VARIABLES

Object values can be specified in the initiation of the BW::Include object in several ways:

   $pf = new BW::Include($filename);

If the new constructor is called with a single scalar argument, it is used for the default filename.

   $pf = new BW::Include(DIR => $path, FILENAME => $filename);

If the new constructor is called with several arguments, they are taken to be hash name/value pairs. These are used as object data variables (see below).

   $pf = new BW::Include( { DIR => $path, FILENAME => $filename } );

Alternately the new constructor may be called with a hash reverence, which will be used for object data variables (see below).

The object data variables are used as follows:

FILENAME

The filesystem name of the file to be included.

DIRECTORY

An optional directory where the filename will be read from. This is useful for putting all of your HTML files in one place. You can specify relative directories from this base in your filenames. For example:

   $pf = new BW::Include ( DIRECTORY => "/home/you/htmlfiles" );

   $pf->pf( "subdirectory/admin.html" );

That will use /home/you/htmlfiles/subdirectory/admin.html as the file to be included.

FILE PROCESSING

Variable Replacement

Including External CGI Programs

mod_inclue Emulation

File Location

AUTHOR

Written by Bill Weinman <http://bw.org/>.

COPYRIGHT

Copyright (c) 1995-2010 The BearHeart Group, LLC

HISTORY

    2010-03-11 bw -- 1.0.2  -- fixed small POD typo
    2010-02-02 bw -- 1.0.1  -- first CPAN version - some cleanup and documenting

4 POD Errors

The following errors were encountered while parsing the POD:

Around line 302:

You forgot a '=back' before '=head2'

Around line 306:

'=item' outside of any '=over'

Around line 329:

You forgot a '=back' before '=head2'

Around line 337:

=back without =over