NAME

HPPPM::ErrorHandler - Error Handling Base class for all HPPPM Classes

VERSION

Version 0.01

SYNOPSIS

Error Handling Base class for all HPPPM Classes.Performs command line parsing, validation of arguments and error extraction.Desginwise, this class is meant to be subclassed and used transparently by HPPPM classes, however it can be instantiated directly.

$hpppm = HPPPM::Demand::Management->new();

$fields = $hpppm->validate_read_cmdargs(@ARGV); $tags = $hpppm->get_inputs($hpppm->get_current_oper());

$inputs = FieldParser::parser($fields, $tags);

$ret = $hpppm->validate_inputs($inputs); $ret = $hpppm->validate_tokens($inputs->{'fields'}) if grep /^fields$/, @{ $tags };

$ret = $hpppm->extract($res, ['faultcode', 'faultstring', 'exception:detail', 'id', 'return']);

DESCRIPTION

Error Handling Base class for all HPPPM Classes.Performs command line parsing, validation of arguments and error extraction.Desginwise, this class is meant to be subclassed and used transparently by HPPPM classes, however it can be instantiated directly.

The class performs validation at various levels:

1. Validating the presence of filenames(with data) passed as cmd args.

2. Web service operation being performed is legal and supported.

3. Before posting Check if the Web Service is up and accessible or not.

4. Validate data that will be used to create Web service request(optional).

The class also provides in-detail execption extraction.

ATTRIBUTES

METHODS

validate_read_cmdargs

perl bin/hpppm_demand.pl -o createRequest -u user -p password -f data/createRequest.data -c cfg/logging.conf

-o or --operation is the webservice operation being performed -u or --user user authorized to perform web service operation -p or --password user's password -f or --fields location of file containing input fields that will be used to create the web service request.Instead of a path this can also be a string containing the input fields.A sample data file for each web service operation has been bundled along with distribution under data dir. -c or --logconfig location to the configuration file that drives logging behavior. -h or --help or -? display help.

validate_inputs

Checks if the required types need in order to perform the operation successfully are present in the input data or not.

validate_tokens

Checks if the operation being performed supports tokens or not. If no tokens are needed the method returns 0.Performs the following checks on tokens as well -All field tokens must be all caps. Token prefixes (REQD, REQ, UD, T, VP, P) must be one of the specified types.All tokens can contain only alphanumeric characters and _ (underscore).Input is input fields and output is Success or Failure

check_url_availability

Tests service URL for accessibility.Input is url to test and return Success or Failure

extract

Extracts the value(s) which are valid tags in the response received in response to the request posted to the webservice.The value(s)/tag(s) must be passed in as a array ref.The return value is a hash ref with key as the tag and value as its extracted value.

AUTHOR

Varun Juyal, <varunjuyal123@yahoo.com>

BUGS

Please report any bugs or feature requests to bug-hpppm-demand-management at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=HPPPM-Demand-Management. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

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

perldoc HPPPM::ErrorHandler

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2012 Varun Juyal.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.