perl

### Index Up << >>

## perl

CALL INFORMATION
  Parameters: tables

  Positional parameters in same order.

  The attribute hash reference is passed after the parameters but before the container text argument. This may mean that there are parameters not shown here.

  Must pass named parameter interpolate=1 to cause interpolation.

  This is a container tag, i.e. [perl] FOO [/perl]. Nesting: NO

  Invalidates cache: YES

  Called Routine:

  ASP/perl tag calls:

          $Tag->perl(
              {
               tables => VALUE,
              },
              BODY
          )

       OR

          $Tag->perl($tables, $ATTRHASH, $BODY);

  Attribute aliases

                  table ==> tables

DESCRIPTION

          [perl]
              $name    = $Values->{name};
              $browser = $Session->{browser};
              return "Hi, $name! How do you like your $browser?
          [/perl]

  HTML example:

          <PRE mv=perl>
              $name    = $Values->{name};
              $browser = $Session->{browser};
              return "Hi, $name! How do you like your $browser?
          </PRE>

  Perl code can be directly embedded in MiniVend pages. The code is specified as [perl arguments*] any_legal_perl_code [/perl]. The value returned by the code will be inserted on the page.

  Object references are available for most MiniVend tags and functions, as well as direct references to MiniVend session and configuration values.

        $CGI->{key}               Hash reference to raw submitted values
        $CGI_array->{key}         Arrays of submitted values
        $Carts->{cartname}        Direct reference to shopping carts
        $Config->{key}            Direct reference to $Vend::Cfg
        $DbSearch->array(@args)   Do a DB search and get results
        $Document->header()       Writes header lines
        $Document->send()         Writes to output
        $Document->write()        Writes to page
        $Scratch->{key}           Direct reference to scratch area
        $Session->{key}           Direct reference to session area
        $Tag->tagname(@args)      Call a tag as a routine (UserTag too!)
        $TextSearch->array(@args) Do a text search and get results
        $Values->{key}            Direct reference to user form values
        $Variable->{key}          Config variables (same as $Config->{Variable});
        &HTML($html)              Same as $Document->write($html);
        &Log($msg)                Log to the error log

  For full descriptions of these objects, see MiniVend Programming.

  If you wish to use database values in your Perl code, you must pre-open the `table(s)` you will be using. This can be done by including the table name in the `tables` parameter of the Perl tag:

          [perl tables=products]
              $result = "You asked about $Values->{code}. Here is the description: ";
              $result .= $Tag->data('products', 'description', $Values->{code});
              return $result;
          [/perl]

  If you do not do this, your code will fail with a runtime Safe error.

### Index Up << >>