The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Language::Basic::Variable - Module to handle parsing and implementing BASIC variables.

SYNOPSIS

See Language::Basic for the overview of how the Language::Basic module works. This pod page is more technical.

There are two sorts of variables: Arrays and Scalars. Each of those classes has a subclass for Numeric or String variables.

DESCRIPTION

An Array needs to have full LBV::Scalar objects in it, rather than just having an array of values. The reason is that, for example, you might use ARR(3) as the variable in a FOR loop. Also, the "set" and "value" methods apply to a LBV::Scalar (since you can't set an array to a value (in BASIC :)) so in order to be handle A(3)=3, A(3) needs to be an LBV::Scalar.

The lookup method looks up a variable in the Array or Scalar lookup table (depending on whether there were parentheses after the variable name). BASIC allows undeclared variables, so if the variable name hasn't been seen before, a new variable is created.

Language::Basic::Variable::Scalar class

This class handles a variable or one cell in an array.

Methods include "value", which gets the variable's value, and "set", which sets it.

Language::Basic::Variable::Array class

This class handles a BASIC array. Each cell in the array is a LBV::Scalar object.

Methods include "dimension", which dimensions the array to a given size (or a default size) and get_cell, which returns the LBV::Scalar object in a given array location.

Note that BASIC arrays start from 0!