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

NAME

Business::ISP::Vars - Perl module used to store various variables used throughout the Business::ISP:: collection of modules.

VERSION

SYNOPSIS

    use Business::ISP::Vars;
    my $vardb = Business::ISP::Vars->new();

    # Retrieve the different payment methods avaiable
    my %payment_options = $vardb->payment_methods();

DESCRIPTION

This module is used to be a single location to store commonly-used list-type variables for ISP applications and modules.

METHODS

new

Instantiates a Business::ISP::Var object. There is no config for this module.

compare({ type => TYPE, data => DATA, error =>ERROR })

Compares a user supplied data structure against the authoritative layout.

It checks for missing and/or extra attributes within the data structure.

TYPE is a mandatory scalar string, and contains one of: plan_info, plan_status, plan, pap_method, pap_date, payment_method, billing_method.

DATA is a mandatory parameter, and is passed in as a hashref.

ERROR is a mandatory parameter, and is an Business::ISP::Error object.

All parameters are passed in within a hash reference.

Will die if the structure is not correct.

Returns 0 upon success.

build_select({ type => TYPE, default => DEFAULT, name => NAME })

Builds an HTML select menu based on the different types.

TYPE is a mandatory scalar string that consists of the text name of one of the external methods within this module.

DEFAULT is an optional scalar string signifying which field you want to use as the 'selected' value.

NAME is an optional scalar string signifying that you want to use NAME as the returned variable name, instead of using TYPE as the name.

All parameters are passed in within a hash reference.

Example use:

    my $plan_name_select  = $vardb->build_select({ plan => 'plan' });
    $self->pb_param( plan => $plan_name_select );

Returns an array reference of the parameters.

is_type( TYPE )

Checks whether a particular data type (structure) exists.

TYPE is an optional string parameter.

If called in list context, will return an array of all the known data types.

Otherwise, it will return true if the type is known, and false if not.

is_credit_card( PAYMENT_METHOD )

Identifies whether a payment method is via a credit card.

PAYMENT_METHOD is a mandatory scalar string of the payment method to check.

Returns 1 if the payment method is a credit card and the configuration file variable 'enable_bank_processing' is set to true, and 0 otherwise.

is_table( NAME )

True/false check to see if a database table schema exists.

NAME is the name of the table to check, and is a mandatory parameter.

Returns 1 if the table exists, and 0 otherwise.

struct( TYPE )

TYPE is a mandatory string parameter.

Returns the complete definition of the data structure identified in TYPE.

Review the "Data Structures" section in this manual for known types.

If called in list context, returns the names of the type as an array, otherwise returns a hash ref.

return_types

Takes no params. Returns an array of all the known data types.

sanity_value_skip_permitted

This method returns a hash ref of attribute names that Business::ISP::Sanity is allowed to bypass it's validate_value() check on.

The keys are the actual attributes allowed to be skipped, the values are undef.

It's designed to be used as an 'exists' lookup table.

plan_classification({ plan => PLAN })

PLAN is the name of an account plan, passed in within a hash reference.

Returns the class the account plan is classified as, if possible. Otherwise, returns undef.

AUTHOR

Steve Bertrand, <steveb at cpan.org>

BUGS

Report bugs to <steveb at cpan.org>. I will be notified, and will report back to you with any updates.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Business::ISP::Vars

COPYRIGHT & LICENSE

Copyright 2012 Steve Bertrand, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.