<<

TITLE

AbstractParser

AUTHOR

paramsan

NAME

AbstractParser: Represents the abstract interface for any parser object which parses weekly specials from a store.This class is only supposed to be used as a base/parent class for a "specific" parser.

SYNOPSIS

        use AbstractParser;

REQUIRES

Perl5.10.0

EXPORTS

Nothing

DESCRIPTION

AbstractParser represents an abstract interface that any class implementing parsing weekly specials should inherit from in the project. As such, the child class should implement any abstract methods below, in particular GetSpecials ("GetSpecials").

Also see AbstractParserFactory on how to construct concrete Parser objects.

CLASS VARIABLES

$AbstractParser::VERBOSITY_ALL

Used to set all verbose level for the parser, that is, all pertinent information, errors, warning, informational messages will be printed.

$AbstractParser::VERBOSITY_NONE

Used to set none verbose level for the parser, that is only errors (printed) are that will cause the module to die()..

METHODS

new (constructor)

$abstractParser = AbstractParser->new();

Creates and returns an AbstractParser. For internal use only, an AbstractParser object is not supposed to be constructed.

Arguments

None

Returns

A reference to an AbstractParser

GetSpecials

Description

The subclasses are supposed to implement this method.

Arguments

$zipCode: Zipcode for which to retrieve the specials for.

Returns

This method should return A reference to an array of Specials in the following format,

[ [ItemName, ItemPrice], [ItemName, ItemPrice] ... ];

This is an abstract method and currently calls die() with the error messsage: "Abstract method GetSpecials not implemented\n"

Usage

$specialRef = $abstractParser->GetSpecials();

GetStoreName

Description

Returns the store name that this parser will parse specials for.

Arguments

None

Returns

The storename as a string.

Usage

$storeName = $abstractParser->GetStoreName();

GetVerbosityLevel

Description

Returns the current verbosity level for the parser

Arguments

None

Returns

The verbosity level. See "Class Variables" for the different verbosity values.

Usage

$verbosityLevel = $abstractParser->GetVerbosityLevel();

SetVerbosityLevel

Description

Sets the verbosity level for the parser.

Arguments

$verbosityLevel The verbosity level. See "Class Variables" for the different verbosity values.

Returns

Nothing

Usage

$abstractParser->SetVerbosityLevel($AbstractParser::VERBOSITY_ALL);

_SetStoreName

Description

Sets the store name for this parser. This is an internal method and to be used by the children classes.

Arguments

$storeName: The store name.

Returns

Nothing

Usage

$abstractParser->_SetStoreName($storeName);

<<