File Coverage

blib/lib/eBay/API/BaseApi.pm
Criterion Covered Total %
statement 16 18 88.8
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 22 24 91.6


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2              
3             #########################################################################
4             #
5             # Module: ............... /eBay/API
6             # File: ................. BaseApi.pm
7             # Original Authors: ..... Jeff Nokes / Bob Bradley
8             # Last Modified By: ..... Jeff Nokes
9             # Last Modified: ........ 03/15/2007 @ 14:46
10             #
11             #########################################################################
12              
13              
14             =pod
15              
16             =head1 NAME
17              
18             eBay::API::BaseApi - Logging, exception handling and authentication frameworks
19             for eBay::API objects.
20              
21             =head1 INHERITANCE
22              
23             This is the base class
24              
25             =head1 DESCRIPTION
26              
27             This top-level module encapsulates all the functionality for the eBay
28             API. This library is really a parent class wrapper to the sub-classes of
29             eBay::API--mainly sessions and api call objects.
30              
31             The main purpose of this framework is to provide event logging,
32             exception handling, and management eBay API certification information.
33              
34             Users of eBay::API can use this facility to debug requests to the eBay
35             API and responses from the eBay API. Unless the user overrides the
36             default behavior, all logging will go to stderr.
37              
38             =cut
39              
40              
41              
42             # Package Declaration
43             # ---------------------------------------------------------------------------
44             package eBay::API::BaseApi;
45              
46              
47             # Required Includes
48             # ---------------------------------------------------------------------------
49 4     4   24531 use strict; # Used to control variable hell.
  4         6  
  4         142  
50 4     4   22 use Exporter; # For Perl symbol export functionality.
  4         8  
  4         154  
51 4     4   3169 use Data::Dumper; # Used for logging support.
  4         27124  
  4         312  
52 4     4   2462 use eBay::Exception qw(:try); # eBay Exceptions framework
  4         14  
  4         47  
53 4     4   4804 use Params::Validate qw(:all); # CPAN validate subroutine parameters
  4         46013  
  4         1064  
54 4     4   3040 use XML::Tidy; # CPAN module to format XML
  0            
  0            
55              
56             use eBay::API::XML::Release; # Defines API release attributes
57             # Api release number
58             # Api release type
59              
60             # Variable Declarations
61             # ---------------------------------------------------------------------------
62             # Constants
63             use constant TRUE => scalar 1;
64             use constant FALSE => scalar 0;
65              
66             use constant LOG_DEBUG => scalar 1; # Pre-defined log levels
67             use constant LOG_INFO => scalar 2;
68             use constant LOG_WARN => scalar 3;
69             use constant LOG_ERROR => scalar 4;
70             use constant LOG_FATAL => scalar 5;
71              
72             use constant DEFAULT_API_COMPATIBILITY_LEVEL =>
73             eBay::API::XML::Release::RELEASE_NUMBER;
74             use constant DEFAULT_EBAY_API_VERSION =>
75             eBay::API::XML::Release::RELEASE_NUMBER;
76             use constant DEFAULT_EBAY_SITE_ID => '0';
77             use constant DEFAULT_EBAY_URI => 'urn:ebay:apis:eBLBaseComponents';
78             use constant DEFAULT_EBAY_ERROR_LANGUAGE => 'en_US';
79             use constant DEFAULT_LOG_LEVEL => LOG_ERROR;
80             use constant DEFAULT_EBAY_API_TIMEOUT => 20;
81              
82              
83              
84             # Global Variables
85             our $VERSION = $API::VERSION; # The version of this class/module, as well as the entire pkg.
86             our $ERROR; # Most recent errors.
87              
88             our @ISA = ("Exporter"); # Need to sub the Exporter class, to use the EXPORT* arrays below.
89              
90             # :DEFAULT exported symbols
91             our @EXPORT = qw(
92             $VERSION
93             $ERROR
94             );
95              
96             # Script Lexical Variables
97             my $this_mod = 'eBay::API::BaseApi'; # Used for logging only.
98              
99             my $LOG_SUB_HANDLE = undef; # User-provided subroutine to use as a logging handler.
100             my $LOG_FILE_HANDLE = *STDERR; # File handle for writing log info.
101             my $LOG_LEVEL = DEFAULT_LOG_LEVEL; # Current logging level for the package
102             my $LOG_HEADER = 0; # Display context along with log message
103              
104             my $CHECK_PARAMETERS = 1;
105              
106             =head1 Subroutines
107              
108             Below is a list of public methods accessed through child classes.
109              
110             =cut
111              
112             # Subroutine Prototypes
113             # -------------------------------------------------------------------------------
114             # Method Name Accessor Priviledges Method Type
115             sub new($;$); # Public Class
116             sub _log_it(;$$); # Private Local
117             sub _logThis($;$$); # Protected Instance
118             sub logMessage($$$;); # Protected Instance
119             sub logXml($$$;); # Protected Instance
120             sub logDebug($$;); # Protected Instance
121             sub logInfo($$;); # Protected Instance
122             sub logError($$;); # Protected Instance
123             sub setLogHeader($$;); # Public Instance
124             sub setLogSubHandle($$;); # Public Instance
125             sub getLogSubHandle($;); # Public Instance
126             sub setLogFileHandle($$;); # Public Instance
127             sub getLogFileHandle($;); # Public Instance
128             sub testLogEntry(;$); # Public Local
129             sub dumpObject($;$); # Public Instance
130             sub setLogLevel($$;); # Public Instance
131             sub getLogLevel($;); # Public Instance
132             sub _setError($$;); # Private Instance
133             sub setDevID($$;); # Public Instance
134             sub getDevID($;); # Public Instance
135             sub setAppID($$;); # Public Instance
136             sub getAppID($;); # Public Instance
137             sub setCertID($$;); # Public Instance
138             sub getCertID($;); # Public Instance
139             sub setSiteID($$;); # Public Instance
140             sub getSiteID($;); # Public Instance
141             sub setUserName($$;); # Public Instance
142             sub getUserName($;); # Public Instance
143             sub setUserPassword($$;); # Public Instance
144             sub getUserPassword($;); # Public Instance
145             sub setAuthToken($$;); # Public Instance
146             sub getAuthToken($;); # Public Instance
147             sub setErrLang($$;); # Public Local
148             sub getErrLang($;); # Public Local
149             sub isSuccess($;); # Public Instance
150             sub getError($;); # Public Instance
151             sub setCompatibilityLevel($$;); # Public Instance
152             sub getCompatibilityLevel($;); # Public Instance
153             sub setVersion($$;); # Public Local
154             sub getVersion($;); # Public Local
155             sub setCompression($$;); # Public Instance
156             sub isCompression($;); # Public Instance
157             sub _check_arg($$;); # Public Package
158             sub enableParameterChecks(;$); # Public Package
159             sub getApiReleaseNumber(); # Public Package
160             sub getApiReleaseType(); # Public Package
161             sub setCallRetry($$;); # Public Instance
162             sub getCallRetry($;); # Public Instance
163             sub setTimeout($$;); # Public Instance
164             sub getTimeout($;); # Public Instance
165              
166             # Main Script
167             # ---------------------------------------------------------------------------
168              
169              
170             # Subroutine Definitions
171             # ---------------------------------------------------------------------------
172              
173             =head2 new()
174              
175             Object constructor for the eBay::API::XML::Session class. This is
176             basically a wrapper around the CPAN LWP::Paralle module.
177              
178             my $call = eBay::API::XML::Session->new(
179             site_id => 0,
180             proxy => 'https://api.ebay.com/ws/api.dll',
181             dev_id => __DEVELOPER_ID__,
182             app_id => __APPLICATION_ID__,
183             cert_id => __CERT_ID__,
184             user_auth_token => __AUTH_TOKEN__,
185             );
186            
187             or
188            
189             my $call = eBay::API::XML::Call::GeteBayOfficialTime->new(
190             site_id => 0,
191             proxy => 'https://api.ebay.com/ws/api.dll',
192             dev_id => __DEVELOPER_ID__,
193             app_id => __APPLICATION_ID__,
194             cert_id => __CERT_ID__,
195             user_auth_token => __AUTH_TOKEN__,
196             );
197            
198             $call->execute();
199             print $call->getEBayOfficialTime();
200            
201             Usage:
202              
203             =over 4
204              
205             =item *
206              
207             eBay::API::XML::Session->new({args})
208              
209             =item *
210              
211             eBay::API::XML::Session::new("eBay::API::XML::Request", {args} )
212              
213             =back
214              
215             Arguments:
216              
217             =over 4
218              
219             =item *
220              
221             The name of this class/package.
222              
223             =item *
224              
225             A hash reference containing the following possible arguments:
226              
227             =over 8
228              
229             =item *
230              
231             B => Scalar representing the eBay site id of the XML API
232             calls. Setting the site id at the session level will provide a
233             default site id for all API calls bundled into a session. The site id
234             for individual calls may still be overridden when the respective
235             request objects are instantiated.
236              
237             If this value is not provided, it will attempt to use
238             the value in the environment variable $EBAY_API_SITE_ID;
239              
240             =item *
241              
242             B => Scalar representing the Developer ID provided to the user
243             by eBay. The developer ID is unique to each licensed developer (or
244             company). By default this will be taken from the environment variable
245             $EBAY_API_DEV_ID, but it can be overridden here or via the setDevID()
246             class method.
247              
248             =item *
249              
250             B => Scalar representing the Application ID provided to the
251             user by eBay. The application ID is unique to each application
252             created by the developer. By default this will be taken from the
253             environment variable $EBAY_API_APP_ID, but it can be overridden here
254             or via the setAppID() class method.
255              
256             =item *
257              
258             B => Scalar representing the Certification ID provided to the
259             user by eBay. The certificate ID is unique to each application
260             created by the developer. By default this will be taken from the
261             environment variable $EBAY_API_CERT_ID, but it can be overridden here
262             or via the setCertID() class method.
263              
264             =item *
265              
266             B => Scalar representing the application level user name
267             for this session. This may be overriden for each bundled call in the
268             session.
269              
270             =item *
271              
272             B => Scalar reprsenting the application level user
273             password for this session. This may be overriden for each bundled
274             call in the session.
275              
276             =item *
277              
278             B => Scalar representing the auth token for the
279             application level user.
280              
281             =item *
282              
283             B => Scalar representing the eBay webservices API version the
284             user wishes to utilize. If this is not set here, it is taken from the
285             environment variable $EBAY_API_VERSION, which can be overridden via
286             the class method setVersion().
287              
288             =item *
289              
290             B => Scalar representing the eBay transport URL needed to send
291             the request to. If this is not set here, it must be set via the
292             setProxy() class method, prior to object instantiation.
293              
294             # Deprecated
295             #=item *
296             #
297             #B => Boolean. TRUE means we'll want debugging for the
298             #request/response. FALSE means no debugging.
299              
300             # Deprecated
301             #=item *
302             #
303             #B => Value for the error language you would like returned to
304             #you for any XML/webservice errors encountered. By design, if this
305             #value is not provided, eBay will return en-US as the default error
306             #language value. This can be set at the class level via the
307             #setErrLang() method, and retrieved from the getErrLang() method. It
308             #can also be set for a particular instance with the instance
309             #getter/setter method errLang().
310              
311             =item *
312              
313             B => This value is defined as a default in each
314             release of the api. But if you need to override the default value,
315             you can do this either when you instatiate your session object, or by
316             using the setter method setCompatibilityLevel().
317              
318             =item *
319              
320             B => Boolean value to indicate if the requests should be
321             issued sequentially if true, and in parallel if false (default). This
322             may also be set with the setter method setExecutionSequential().
323              
324             =item *
325              
326             B => Scalar numerical value indicating the number of seconds to
327             wait on an http request before timing out. Setting this to 0 will cause
328             the requests to block. Otherwise the default is that of LWP::UserAgent.
329             This may also be set with the instance setter method setTimeout();
330              
331             =back
332              
333             =back
334              
335             Returns:
336              
337             =over 4
338              
339             =item *
340              
341             B Object reference to the eBay::API::XML::Session class.
342              
343             =item *
344              
345             B undefined
346              
347             =back
348              
349             =cut
350              
351             sub new($;$) {
352              
353             # Get all arguments passed in.
354             my($class, $arg_hash) = @_;
355              
356             # Validation
357             eBay::API::BaseApi::_check_arg($class, Params::Validate::SCALAR);
358              
359              
360             # Local Variables
361             my $self = {}; # This object to be blessed.
362              
363             # We want to immediately bless ourselves into this __PACKAGE__ so we
364             # can start setting object attributes right away, and use any
365             # available instance methods.
366             bless($self, $class);
367              
368              
369             if (defined $ENV{EBAY_LOG_LEVEL} && $ENV{EBAY_LOG_LEVEL} && $ENV{EBAY_LOG_LEVEL} > 0 ) {
370             $LOG_LEVEL = $ENV{EBAY_LOG_LEVEL};
371             }# end if
372              
373             if (defined $::RALF and $::RALF) {
374             $LOG_FILE_HANDLE = $::RALF;
375             }# end if
376              
377             if ( $ENV{EBAY_API_COMPATIBILITY_LEVEL} ) {
378             $self->{compatibility_level} = $ENV{EBAY_API_COMPATIBILITY_LEVEL};
379             } else {
380             $self->{compatibility_level} = DEFAULT_API_COMPATIBILITY_LEVEL;
381             }
382              
383             if ( $ENV{EBAY_API_SITE_ID}) {
384             $self->{site_id} = $ENV{EBAY_API_SITE_ID};
385             } else {
386             $self->{site_id} = DEFAULT_EBAY_SITE_ID;
387             }
388              
389             $self->{dev_id} = $ENV{EBAY_API_DEV_ID};
390             $self->{app_id} = $ENV{EBAY_API_APP_ID};
391             $self->{cert_id} = $ENV{EBAY_API_CERT_ID};
392             $self->{user_name} = $ENV{EBAY_API_USER_NAME};
393             $self->{user_password} = $ENV{EBAY_API_USER_PASSWORD};
394             $self->{user_auth_token} = $ENV{EBAY_API_USER_AUTH_TOKEN};
395             $self->{proxy} = $ENV{EBAY_API_XML_TRANSPORT};
396              
397             # Deprecated
398             # if ($ENV{EBAY_API_XML_ERR_LANG}) {
399             # $self->{err_lang} = $ENV{EBAY_API_XML_ERR_LANG};
400             # } else {
401             # $self->{err_lang} = DEFAULT_EBAY_ERROR_LANGUAGE;
402             # }
403              
404             # Deprecated
405             # if ($ENV{EBAY_API_URI} ) {
406             # $self->{xml_uri} = $ENV{EBAY_API_URI};
407             # } else {
408             # $self->{xml_uri} = DEFAULT_EBAY_URI;
409             # }
410              
411             if ($ENV{EBAY_API_VERSION} ) {
412             $self->{api_ver} = $ENV{EBAY_API_VERSION};
413             } else {
414             $self->{api_ver} = DEFAULT_EBAY_API_VERSION;
415             }
416              
417             if ($ENV{EBAY_API_TIMEOUT} ) {
418             $self->{timeout} = $ENV{EBAY_API_TIMEOUT};
419             } else {
420             $self->{timeout} = DEFAULT_EBAY_API_TIMEOUT;
421             }
422              
423             # Before we start setting local variables assuming we have an
424             # $arg_hash, validate that we actaully do have one. If we have an
425             # argument but it's not a hash reference, set/log $ERROR and return
426             # failure to the caller. If we have a valid hash reference argument,
427             # attempt to set the appropriate object attributes.
428             if (defined($arg_hash) ) {
429             eBay::API::BaseApi::_check_arg($arg_hash, Params::Validate::HASHREF);
430             }# end if
431              
432             if (defined($arg_hash) && (ref($arg_hash) =~ /HASH/o))
433             {
434             if ($arg_hash->{site_id}) {$self->{site_id} = $arg_hash->{site_id};}
435             if ($arg_hash->{dev_id}) {$self->{dev_id} = $arg_hash->{dev_id};}
436             if ($arg_hash->{app_id}) {$self->{app_id} = $arg_hash->{app_id};}
437             if ($arg_hash->{cert_id}) {$self->{cert_id} = $arg_hash->{cert_id};}
438             #if ($arg_hash->{xml_uri}) {$self->{xml_url} = $arg_hash->{xml_uri};} # Deprecated
439             if ($arg_hash->{user_name}) {$self->{user_name} = $arg_hash->{user_name};}
440             if ($arg_hash->{user_password}) {$self->{user_password} = $arg_hash->{user_password};}
441             if ($arg_hash->{user_auth_token}) {$self->{user_auth_token} = $arg_hash->{user_auth_token};}
442             if ($arg_hash->{api_ver}) {$self->{api_ver} = $arg_hash->{api_ver};}
443             #if ($arg_hash->{err_lang}) {$self->{err_lang} = $arg_hash->{err_lang};} # Deprecated
444             if ($arg_hash->{proxy}) {$self->{proxy} = $arg_hash->{proxy};}
445             if ($arg_hash->{debug}) {$self->{debug} = $arg_hash->{debug};}
446             if ($arg_hash->{timeout}) {$self->{timeout} = $arg_hash->{timeout};}
447             if ($arg_hash->{compatibility_level}) {
448             $self->{compatibility_level} = $arg_hash->{compatibility_level};
449             }# end if
450              
451             }# end if
452              
453              
454             # Else-if we have an $arg_hash but it isn't a hash reference,
455             # set/log $ERROR and return failure to the caller.
456             elsif (defined($arg_hash) && (ref($arg_hash) !~ /HASH/o)) {
457             return(undef());
458             }# end elsif
459              
460             # Else, assume the caller doesn't want to set any object attributes.
461             else {} # end else
462              
463             # Add an error attribute to always contain the most recent error data in scalar form.
464             $API::ERROR = $self->{error} = '';
465              
466              
467             # If we've gotten this far, we have a class (we hope), return success to the caller.
468             return($self);
469              
470             }# end sub new()
471              
472             =head2 setLogHeader()
473              
474             Instance method to enable or disable additional context information
475             to display with log messages. This information includes date, time,
476             and logging level.
477              
478             Arguments:
479              
480             =over 4
481              
482             =item *
483              
484             A reference to object of type eBay::API.
485              
486             =item *
487              
488             Boolean value (0 = false; non-zero = true);
489              
490             =back
491              
492             Returns:
493              
494             =over 4
495              
496             =item *
497              
498             The boolean value to be set for this attribute.
499              
500             =back
501              
502             =cut
503              
504              
505              
506             sub setLogHeader($$;) {
507             my $self = shift;
508             my $bool = shift;
509             # Validation
510             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
511             eBay::API::BaseApi::_check_arg($bool, Params::Validate::BOOLEAN);
512             $LOG_HEADER = $bool;
513             return $bool;
514             }
515              
516              
517             # _log_it()
518             #
519             # Description: Local method used to support logging functionality. This sub will allow
520             # for itself to be a wrapper for another sub handle if $LOG_SUB_HANDLE is
521             # set. Otherwise, it will default to printing to $LOG_FILE_HANDLE.
522             #
523             # Access: Private
524             #
525             # Note: If using the $LOG_SUB_HANDLE, make sure your user sub accepts an
526             # argument of type scalar!
527             #
528             # Optional arguments:
529             #
530             # A scalar or scalar reference containing the data you want to be logged.
531             # A scalar containing the level at which to log.
532             #
533             # Returns: upon success: TRUE
534             # upon failure: undefined
535              
536              
537             sub _log_it(;$$) {
538              
539             # Get all arguments passed in
540             my($in_data, $log_level) = @_;
541              
542             # Local Variables
543             my $out_data; # Used to store the final stringified data to be logged.
544             my $rv; # Used to store a return value
545              
546             # First, determine if the $in_data provided is a scalar or a reference to a
547             # scalar, and set $out_data to always be a scalar.
548             if (ref($in_data) =~ /SCALAR/og)
549             {$out_data = $$in_data; # Dereference the scalar reference, to get the raw scalar data
550             }# end if
551             else {$out_data = $in_data;
552             }# end else
553              
554             my $current_time = time(); # Need this for the log message
555             my $delim = '|';
556             my $level = '';
557             if (defined $log_level) {
558             if ($log_level == LOG_DEBUG) {$level='DEBUG'};
559             if ($log_level == LOG_INFO) {$level='INFO'};
560             if ($log_level == LOG_WARN) {$level='WARNING'};
561             if ($log_level == LOG_ERROR) {$level='ERROR'};
562             if ($log_level == LOG_FATAL) {$level='CRITICAL'};
563             }
564              
565             # Construct context for the log message
566             my $header = scalar (localtime) . $delim . # Current system date in form of MM-DD-YYYY
567             $level . ": "; # Logging level (debug, info, error, etc.)
568             if ($LOG_HEADER){
569             $out_data = $header . $out_data;
570             }
571              
572             # Now print the log data. Either pass it to the handler provided in the lexical
573             # var $LOG_SUB_HANDLE or print it to the $LOG_FILE_HANDLE.
574             if ($LOG_SUB_HANDLE)
575             {&$LOG_SUB_HANDLE($out_data); # Peform logging with user supplied subroutine reference.
576             $rv = 1; # Since we don't know anything about the user supplied handler,
577             # we'll assume success.
578             }# end if
579             else {$rv = print $LOG_FILE_HANDLE ($out_data);
580             }# end else
581              
582             # Return success or failure to the caller.
583             if ($rv) # Success
584             {return(TRUE);
585             }# end if
586             else {return(undef()); # Failure
587             }# end else
588              
589             }# end sub _log_it()
590              
591              
592              
593              
594              
595             # _logThis()
596             #
597             # Description: Instance method used as a wrapper for the local subroutine _log_it().
598             #
599             # Access: Private
600             #
601             # Arguments: 01 [R] A refernce to an object of type eBay::API
602             # 02 [O] A scalar or scalar reference containing the data you want to be logged.
603             # 02 [O] A scalar containing the logging level
604             #
605             # Returns: upon success: same as _log_it()
606             # upon failure: same as _log_it()
607              
608             sub _logThis($;$$) {
609              
610             # Get all arguments passed in
611             my($self, $in_data, $level) = @_;
612              
613             # Local Variables
614             my $this_sub = '_logThis()'; # Used for logging
615             my $rv; # Used to store a return value
616              
617             # Just call the local subroutine _log_it to perform the actual logging.
618             $rv = _log_it($in_data, $level);
619              
620             # Return whaver return code came back from _log_it to the caller.
621             return($rv);
622              
623             }# end sub _logThis()
624              
625              
626             =pod
627              
628             =head2 logDebug()
629              
630             Public convenience method to log debug messages. This is the same as doing
631              
632             $rc = $api->logMessage(eBay::API::BaseApi::LOG_DEBUG, "This is debug message.\n");
633              
634             Arguments:
635              
636             =over 4
637              
638             =item *
639              
640             Reference to an object of type eBay::API.
641              
642             =item *
643              
644             Scalar data to be logged.
645              
646             =back
647              
648             Returns:
649              
650             =over 4
651              
652             =item *
653              
654             True if message was logged; otherwise undef.
655              
656             =back
657              
658             =cut
659              
660              
661             sub logDebug($$;) {
662             my ($self, $msg) = @_;
663              
664             # Validate the arguments
665             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
666             eBay::API::BaseApi::_check_arg($msg, Params::Validate::SCALAR);
667              
668             return $self->logMessage(LOG_DEBUG, $msg);
669             }
670              
671              
672              
673             =pod
674              
675             =head2 logInfo()
676              
677             Public convenience method to log info messages. This is the same as doing
678              
679             $rc = $api->logMessage(eBay::API::BaseApi::LOG_INFO, "This is an info message.\n");
680              
681             Arguments:
682              
683             =over 4
684              
685             =item *
686              
687             Reference to an object of type eBay::API.
688              
689             =item *
690              
691             Scalar data to be logged.
692              
693             =back
694              
695             Returns:
696              
697             =over 4
698              
699             =item *
700              
701             True if message was logged; otherwise undef.
702              
703             =back
704              
705             =cut
706              
707              
708             sub logInfo($$;) {
709             my ($self, $msg) = @_;
710              
711             # Validate the arguments
712             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
713             eBay::API::BaseApi::_check_arg($msg, Params::Validate::SCALAR);
714              
715             return $self->logMessage(LOG_INFO, $msg);
716             }
717              
718              
719              
720             =pod
721              
722             =head2 logError()
723              
724             Public convenience method to log error messages. This is the same as doing
725              
726             $rc = $api->logMessage(eBay::API::BaseApi::LOG_ERROR, "This is an error message.\n");
727              
728             Arguments:
729              
730             =over 4
731              
732             =item *
733              
734             Reference to an object of type eBay::API.
735              
736             =item *
737              
738             Scalar data to be logged.
739              
740             =back
741              
742             Returns:
743              
744             =over 4
745              
746             =item *
747              
748             True if message was logged; otherwise undef.
749              
750             =back
751              
752             =cut
753              
754              
755             sub logError($$;) {
756             my ($self, $msg) = @_;
757              
758             # Validate the arguments
759             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
760             eBay::API::BaseApi::_check_arg($msg, Params::Validate::SCALAR);
761              
762             return $self->logMessage(LOG_ERROR, $msg);
763             }
764              
765              
766              
767              
768             =pod
769              
770             =head2 logMessage()
771              
772             Description: Instance method to log application events. This is the
773             main entry point for logging messages that should be filtered
774             depending on the setting for the logging level. If the logging level
775             of the message is lower than the current default logging level, the
776             message will NOT be logged.
777              
778             Arguments:
779              
780             =over 4
781              
782             =item *
783              
784             Reference to an object of type eBay::API.
785              
786             =item *
787              
788             Scalar log level.
789              
790             =item *
791              
792             Scalar data to be logged.
793              
794             =back
795              
796             Returns:
797              
798             =over 4
799              
800             =item *
801              
802             True if message was logged; otherwise undef.
803              
804             =back
805              
806             =cut
807              
808              
809              
810              
811             sub logMessage($$$;) {
812              
813             my ($self, $loglevel, $msg) = @_;
814              
815             # Validate the arguments
816             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
817             eBay::API::BaseApi::_check_arg($loglevel, Params::Validate::SCALAR);
818             eBay::API::BaseApi::_check_arg($msg, Params::Validate::SCALAR);
819              
820             if ($loglevel >= $LOG_LEVEL) {
821             return (_log_it($msg, $loglevel));
822             }
823             return (undef());
824             }
825              
826              
827              
828              
829              
830             =pod
831              
832             =head2 logXml()
833              
834             Description: Instance method to log application xml text. This is
835             mainly a wrapper to logMessage() and takes the same arguments. This
836             method assumes the message text is valid xml and will use XML::Tidy
837             to clean it up some before logging it.
838              
839             If the xml cannot be parsed and cleaned up, it will just be logged 'as
840             is'.
841              
842             Warning: XML::Tidy does not handle headers like
843              
844            
845              
846             and will DELETE them from the message.
847              
848             Arguments:
849              
850             =over 4
851              
852             =item *
853              
854             Reference to an object of type eBay::API.
855              
856             =item *
857              
858             Scalar log level.
859              
860             =item *
861              
862             Scalar data to be logged.
863              
864             =back
865              
866             Returns:
867              
868             =over 4
869              
870             =item *
871              
872             True if message was logged; otherwise undef.
873              
874             =back
875              
876             =cut
877              
878              
879              
880              
881             sub logXml($$$;) {
882              
883             my ($self, $loglevel, $msg) = @_;
884              
885             # Validate the arguments
886             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
887             eBay::API::BaseApi::_check_arg($loglevel, Params::Validate::SCALAR);
888             eBay::API::BaseApi::_check_arg($msg, Params::Validate::SCALAR);
889              
890             if ($loglevel >= $LOG_LEVEL) {
891             my $t = new XML::Tidy($msg);
892             # XML::Tidy trashes things like: !!!
893             # TODO: read up on Tidy some more and see if there is a switch to stop this
894             my $tidytext;
895             eval {
896             $tidytext = $t->tidy()->toString();
897             };
898             # if tidy croaked just log the message
899             if ($@) {
900             return (_log_it($msg, $loglevel));
901             } else {
902             return (_log_it($tidytext . "\n", $loglevel));
903             }
904             }
905             return (undef());
906             }
907              
908              
909              
910             =head2 setLogSubHandle()
911              
912             Sets the class variable, $LOG_SUB_HANDLE, which allows users to
913             customize all of its logging features, and those of it's children.
914             The only required argument is a reference to a subroutine that should
915             be able to accept a single scalar argument. By setting this, all
916             logging normally performed by this and child modules will be tasked to
917             the user provided handler.
918              
919             Arguments:
920              
921             =over 4
922              
923             =item *
924              
925             Object reference of type eBay::API.
926              
927             =item *
928              
929             Reference to a logging handler subroutine, provided by user
930              
931             =back
932              
933             Returns:
934              
935             =over 4
936              
937             =item *
938              
939             B The value of $LOG_SUB_HANDLE after setting with user
940             provided sub reference (should be the same value that was provided by
941             the user)
942              
943             =item *
944              
945             B undefined
946              
947             =back
948              
949             =cut
950              
951              
952             sub setLogSubHandle ($$;) {
953              
954             # Local Variables
955             my $this_sub = 'setLogSubHandle'; # Used for logging
956              
957             # Get all values passed in
958             my ($self, $subref) = @_;
959              
960             # Validate the arguments
961             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
962              
963             # Validate that we really have a subroutine reference.
964             if (ref($subref) !~ /CODE/o) {
965             $LOG_SUB_HANDLE = undef();
966             return(undef());
967             }# end if
968              
969             # If we got this far, must be a valid sub reference, set it.
970             $LOG_SUB_HANDLE = $subref;
971              
972             # Return success to the caller.
973             return($LOG_SUB_HANDLE);
974              
975             }# end sub setLogSubHandle()
976              
977              
978              
979             =head2 getLogSubHandle()
980              
981             Returns a reference to a subroutine handling logging messages if one
982             has been set by setLogSubHandle() previously.
983              
984             Arguments:
985              
986             =over 4
987              
988             =item *
989              
990             Object reference of type eBay::API.
991              
992             =back
993              
994             Returns:
995              
996             =over 4
997              
998             =item *
999              
1000             B The current value of $LOG_SUB_HANDLE
1001              
1002             =item *
1003              
1004             B undefined, not currently possible to get this
1005              
1006             =back
1007              
1008             =cut
1009              
1010              
1011              
1012              
1013             sub getLogSubHandle ($;) {
1014              
1015             my $self = shift;
1016             # Validate the arguments
1017             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
1018              
1019             # Return success to the caller.
1020             return($LOG_SUB_HANDLE);
1021              
1022             }# end sub getLogSubHandle()
1023              
1024              
1025              
1026             =head2 setLogFileHandle()
1027              
1028             Sets a custom log file handle, which will allow users of this module
1029             to customize all of its logging features, and those of it's children.
1030             The log file handle argument is a typeglob (or reference to a
1031             typeglob; e.g. \*STDOUT) of a file handle that the user wishes all
1032             error/app logging be sent to, instead of the default STDERR. By
1033             setting this, all logging normally performed by this and child modules
1034             will be sent to the user provided file handle.
1035              
1036             Arguments:
1037              
1038             =over 4
1039              
1040             =item *
1041              
1042             Reference to object of type eBay::API.
1043              
1044             =item *
1045              
1046             Typeglob (or reference to a typeglob) of a user specific file handle
1047              
1048             =back
1049              
1050             Returns:
1051              
1052             =over 4
1053              
1054             =item *
1055              
1056             B The value of $LOG_FILE_HANDLE after setting with user
1057             provided file handle. (It should be the same value that was provided
1058             by the user.)
1059              
1060             =item *
1061              
1062             B undefined
1063              
1064             =back
1065              
1066             =cut
1067              
1068              
1069             sub setLogFileHandle ($$;) {
1070              
1071             # Local Variables
1072             my $this_sub = 'setLogFileHandle'; # Used for logging
1073              
1074             # Get all values passed in
1075             my ($self, $fh) = @_;
1076              
1077             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
1078             eBay::API::BaseApi::_check_arg($fh, Params::Validate::GLOB | Params::Validate::GLOBREF);
1079              
1080             # If we got this far, must be a valid file handle, set it.
1081             $LOG_FILE_HANDLE = $fh;
1082              
1083             # Return success to the caller.
1084             return($LOG_FILE_HANDLE);
1085              
1086             }# end sub setLogFileHandle()
1087              
1088              
1089              
1090             =head2 getLogFileHandle()
1091              
1092             Returns the current log file handle. If this had not been previously
1093             set by the user of the module, it should return STDERR.
1094              
1095             Arguments: none
1096              
1097             Returns:
1098              
1099             =over 4
1100              
1101             =item *
1102              
1103             B The current value of $LOG_FILE_HANDLE
1104              
1105             =item *
1106              
1107             B undefined, not currently possible to get this
1108              
1109             =back
1110              
1111             =cut
1112              
1113              
1114              
1115             sub getLogFileHandle ($;) {
1116              
1117             my $self = shift;
1118              
1119             # Validate the arguments
1120             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
1121              
1122             # Return success to the caller.
1123             return($LOG_FILE_HANDLE);
1124              
1125             }# end sub getLogFileHandle()
1126              
1127              
1128              
1129             =head2 testLogEntry()
1130              
1131             Testing any user-specific overrides to default log output file or logging handler
1132             subroutine.
1133              
1134             Arguments:
1135              
1136             =over 4
1137              
1138             =item *
1139              
1140             Reference to object of type eBay::API.
1141              
1142             =item *
1143              
1144             Scalar representing some test data to log.
1145              
1146             =back
1147              
1148             Returns:
1149              
1150             =over 4
1151              
1152             =item *
1153              
1154             B TRUE
1155              
1156             =item *
1157              
1158             B undefined
1159              
1160             =back
1161              
1162             =cut
1163              
1164              
1165              
1166             sub testLogEntry (;$) {
1167              
1168             # Local Variables
1169             my $this_sub = 'testLogEntry'; # Used for logging
1170             my $rv; # Used for storing return codes
1171              
1172             # Get any values passed in.
1173             my($self, $test_data) = @_;
1174              
1175             # Attempt to print the test data using the internal class method _log_it().
1176             chomp($test_data);
1177             $rv = _log_it($this_mod . '::' .
1178             $this_sub . ': Test Log Entry = ' . $test_data . "\n");
1179              
1180             # Return success/failure to the caller.
1181             if ($rv)
1182             {return(TRUE);
1183             }# end if
1184             else {return(undef());
1185             }# end else
1186              
1187             }# end sub testLogEntry()
1188              
1189              
1190              
1191             =head2 dumpObject()
1192              
1193             Instance method use mostly for debugging. It will dump the entire
1194             structure of an object. If an object is supplied as an argument,
1195             that object will be dumped; otherwise the instance of the class
1196             calling this method will be dumped in its entirety.
1197              
1198             By design, the dump will use the protected logging method _logThis(),
1199             so whatever settings the user has to override the default logging,
1200             that where it will go, hopefully ...
1201              
1202             You need to have log level DEBUG set for this to actually log
1203             anything.
1204              
1205             Arguments:
1206              
1207             =over 4
1208              
1209             =item *
1210              
1211             Object reference of type eBay::API::* or lower.
1212              
1213             =item *
1214              
1215             Optional object or hash reference.
1216              
1217             =back
1218              
1219             Returns:
1220              
1221             =over 4
1222              
1223             =item *
1224              
1225             B Whatever _logThis() returns. (Note: It will however dump
1226             the entire structure of the object at this point in time.)
1227              
1228             =item *
1229              
1230             B Whatever _logThis() returns.
1231              
1232             =back
1233              
1234             =cut
1235              
1236              
1237              
1238             sub dumpObject($;$) {
1239              
1240             # Get all values passed in.
1241             my($self, $object) = @_;
1242              
1243             # Local Variables
1244             my $this_sub = 'dumpObject()'; # Used for logging.
1245             my $rv; # Stores a return value.
1246              
1247             # Set the indentation for Data::Dumper.
1248              
1249             # Description taken from Data::Dumper:
1250              
1251             # Controls the style of indentation. It can be set to 0, 1, 2 or
1252             # 3. Style 0 spews output without any newlines, indentation, or
1253             # spaces between list items. It is the most compact format
1254             # possible that can still be called valid perl. Style 1 outputs a
1255             # readable form with newlines but no fancy indentation (each
1256             # level in the structure is simply indented by a fixed amount of
1257             # whitespace). Style 2 (the default) outputs a very readable
1258             # form which takes into account the length of hash keys (so the
1259             # hash value lines up). Style 3 is like style 2, but also
1260             # annotates the elements of arrays with their index (but the
1261             # comment is on its own line, so array output consumes twice the
1262             # number of lines). Style 2 is the default.
1263              
1264              
1265             $Data::Dumper::Indent = 1;
1266              
1267             # Since 5.8.1 Dumper randomizes the order of hash keys for security
1268             # reasons. We don't want that if we need to diff output results from
1269             # different versions of the software for unit test purposes. So
1270             # turn key sorting back on.
1271              
1272             $Data::Dumper::Sortkeys = 1;
1273              
1274             # Dump the entire object
1275             if (defined $object) {
1276             $rv = $self->_logThis($this_mod . '::' . $this_sub . "\n" .
1277             'Dump of current object of type \'' . ref($object) . "'\n" .
1278             "--------------------------------------------------------------------------------\n" .
1279             Dumper($object) . "\n", eBay::API::BaseApi::LOG_DEBUG
1280             );
1281             } else {
1282             $rv = $self->_logThis($this_mod . '::' . $this_sub . "\n" .
1283             'Dump of current object of type \'' . ref($self) . "'\n" .
1284             "--------------------------------------------------------------------------------\n" .
1285             Dumper($self) . "\n",eBay::API::BaseApi::LOG_DEBUG
1286             );
1287             }
1288              
1289             # Return success to the caller.
1290             return($rv);
1291              
1292             }# end sub dumpObject()
1293              
1294              
1295              
1296              
1297              
1298              
1299             =head2 setLogLevel()
1300              
1301             Setter method for setting the logging level of eBay::API and all child
1302             classes. Log levels may be set with any of the following constants.
1303              
1304             =over 4
1305              
1306             =item *
1307              
1308             B Full debugging information is logged, along
1309             with all log messages of higher levels.
1310              
1311             =item *
1312              
1313             B Informational and all higher logging level
1314             messages are logged.
1315              
1316             =item *
1317              
1318             B Warnings and all higher logging level messages
1319             are logged.
1320              
1321             =item *
1322              
1323             B Errors and all higher logging level messages
1324             are logged.
1325              
1326             =item *
1327              
1328             B Only errors which causes immediate termination
1329             of the current transaction are logged.
1330              
1331             =back
1332              
1333             Arguments:
1334              
1335             =over 4
1336              
1337             =item *
1338              
1339             Reference to object of type eBay::API.
1340              
1341             =item *
1342              
1343             Scalar constant logging level.
1344              
1345             =back
1346              
1347             Returns:
1348              
1349             =over 4
1350              
1351             =item *
1352              
1353             B: The logging level requested.
1354              
1355             =item *
1356              
1357             B: Undef if an invalid logging level is requested. In this
1358             case the logging level is left unchanged from the current logging
1359             level.
1360              
1361             =back
1362              
1363             =cut
1364              
1365              
1366              
1367             sub setLogLevel($$;) {
1368              
1369              
1370             # Get all values passed in.
1371             my ($self, $level) = @_;
1372              
1373             # Validate the arguments.
1374             # Sub prototype deals with case of missing required argument
1375              
1376             # Validate the arguments
1377             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
1378             eBay::API::BaseApi::_check_arg($level, Params::Validate::SCALAR);
1379              
1380             $LOG_LEVEL = $level;
1381              
1382             # Return success to the caller
1383             return($LOG_LEVEL);
1384              
1385             }# end sub setLogLevel()
1386              
1387              
1388              
1389             =head2 getLogLevel()
1390              
1391             Get the current logging level. See setLoglevel() for details on the
1392             logging levels supported.
1393              
1394             Arguments: none
1395              
1396             Returns:
1397              
1398             =over 4
1399              
1400             =item *
1401              
1402             B: The current logging level.
1403              
1404             =item *
1405              
1406             B: undefined
1407              
1408             =back
1409              
1410             =cut
1411              
1412              
1413              
1414             sub getLogLevel($;) {
1415              
1416             # Local Variables
1417             #my $this_sub = 'getDebug'; # Used for logging
1418              
1419             my $self = shift;
1420              
1421             # validate that first argument is blessed object
1422             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
1423              
1424             # Return success to the caller
1425             return($LOG_LEVEL);
1426              
1427             }# end sub getLogLevel()
1428              
1429             =head2 setDevID()
1430              
1431             Sets the dev id for api certification. This variable is set to default
1432             to the value of $ENV{EBAY_API_DEV_ID}. You can override this either
1433             when constructing a session object or by using this method after
1434             construction of the session.
1435              
1436             Arguments:
1437              
1438             =over 4
1439              
1440             =item *
1441              
1442             Reference to object of type eBay::API::XML::Session.
1443              
1444             =item *
1445              
1446             Scalar representing the eBay Developer ID of the eBay API request.
1447              
1448             =back
1449              
1450             Returns:
1451              
1452             =over 4
1453              
1454             =item *
1455              
1456             B The value of the dev id.
1457              
1458             =item *
1459              
1460             B undefined
1461              
1462             =back
1463              
1464             =cut
1465              
1466              
1467              
1468             sub setDevID($$;) {
1469              
1470             # Local Variables
1471             #my $this_sub = 'setDevID';
1472              
1473             # Get all values passed in.
1474             my($self, $devid) = @_;
1475              
1476             # Some validation of the existence of the argument is done implicitly via the sub prototype.
1477             # validate the arguments for existence and data type
1478             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
1479             eBay::API::BaseApi::_check_arg($devid, Params::Validate::SCALAR);
1480              
1481              
1482             $self->{dev_id} = $devid;
1483              
1484             # Return success to the caller.
1485             return($devid);
1486              
1487             }# end sub setDevID()
1488              
1489              
1490              
1491             =head2 getDevID()
1492              
1493             Gets the current dev id setting.
1494              
1495             Arguments:
1496              
1497             =over 4
1498              
1499             =item *
1500              
1501             Reference to a session object.
1502              
1503             =back
1504              
1505             Returns:
1506              
1507             =over 4
1508              
1509             =item *
1510              
1511             B The value of the dev id.
1512              
1513             =item *
1514              
1515             B undefined
1516              
1517             =back
1518              
1519             =cut
1520              
1521              
1522              
1523             sub getDevID($;) {
1524              
1525             # Local Variables
1526             #my $this_sub = 'getDevID';
1527              
1528             my $self = shift;
1529              
1530             # validate the arguments for existence and data type
1531             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
1532              
1533              
1534             # Return success to the caller.
1535             return($self->{dev_id});
1536              
1537             }# end sub getDevID()
1538              
1539              
1540              
1541             =head2 setAppID()
1542              
1543             Sets the app id for ebay certification. This value defaults to
1544             $ENV{EBAY_API_APP_ID}, and is overridden either by calling this method
1545             or if it is specified when constructing a session object.
1546              
1547             Arguments:
1548              
1549             =over 4
1550              
1551             =item *
1552              
1553             Reference to a session object.
1554              
1555             =item *
1556              
1557             Scalar representing the eBay Application ID of the eBay API request.
1558              
1559             =back
1560              
1561             Returns:
1562              
1563             =over 4
1564              
1565             =item *
1566              
1567             B The value of new app id.
1568              
1569             =item *
1570              
1571             B undefined
1572              
1573             =back
1574              
1575             =cut
1576              
1577              
1578              
1579              
1580             sub setAppID($$;) {
1581              
1582             # Local Variables
1583             #my $this_sub = 'setAppID';
1584              
1585             # Get all values passed in.
1586             my($self, $appid) = @_;
1587              
1588             # Validation
1589             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
1590             eBay::API::BaseApi::_check_arg($appid, Params::Validate::SCALAR);
1591              
1592             # Set the proxy
1593             $self->{app_id} = $appid;
1594              
1595             # Return success to the caller.
1596             return($appid);
1597              
1598             }# end sub setAppID()
1599              
1600              
1601              
1602             =head2 getAppID()
1603              
1604             Get the current app id for the session.
1605              
1606             Arguments:
1607              
1608             =over 4
1609              
1610             =item *
1611              
1612             Reference to a session object.
1613              
1614             =back
1615              
1616             Returns:
1617              
1618             =over 4
1619              
1620             =item *
1621              
1622             B The value of the app id.
1623              
1624             =item *
1625              
1626             B undefined
1627              
1628             =back
1629              
1630             =cut
1631              
1632              
1633              
1634             sub getAppID($;) {
1635              
1636             # Local Variables
1637             #my $this_sub = 'getAppID';
1638              
1639             my $self = shift;
1640              
1641             # Validation
1642             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
1643              
1644              
1645             # Return success to the caller.
1646             return($self->{app_id});
1647              
1648             }# end sub getAppID()
1649              
1650              
1651              
1652             =head2 setCertID()
1653              
1654             Sets the cert id for the session. This overrides any default in
1655             $ENV{EBAY_API_CERT_ID}, or any value specified when the session was
1656             originally constructed.
1657              
1658             Arguments:
1659              
1660             =over 4
1661              
1662             =item *
1663              
1664             Reference to a session object.
1665              
1666             =item *
1667              
1668             Scalar representing the eBay Certification ID of the eBay API request.
1669              
1670             =back
1671              
1672             Returns:
1673              
1674             =over 4
1675              
1676             =item *
1677              
1678             B The cert id just set.
1679              
1680             =item *
1681              
1682             B undefined
1683              
1684             =back
1685              
1686             =cut
1687              
1688              
1689              
1690              
1691             sub setCertID($$;) {
1692              
1693             # Local Variables
1694             #my $this_sub = 'setCertID';
1695              
1696             # Get all values passed in.
1697             my($self, $certid) = @_;
1698             # Validation of the existence of the argument is done implicitly via the sub prototype.
1699              
1700             # Validation
1701             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
1702             eBay::API::BaseApi::_check_arg($certid, Params::Validate::SCALAR);
1703              
1704              
1705             # Set the proxy
1706             $self->{cert_id} = $certid;
1707              
1708             # Return success to the caller.
1709             return($certid);
1710              
1711             }# end sub setCertID()
1712              
1713              
1714              
1715             =head2 getCertID()
1716              
1717             Gets current cert id.
1718              
1719             Arguments:
1720              
1721             =over 4
1722              
1723             =item *
1724              
1725             Reference to session object.
1726              
1727             =back
1728              
1729             Returns:
1730              
1731             =over 4
1732              
1733             =item *
1734              
1735             B The value of the cert id.
1736              
1737             =item *
1738              
1739             B undefined
1740              
1741             =back
1742              
1743             =cut
1744              
1745              
1746              
1747             sub getCertID($;) {
1748              
1749             # Local Variables
1750             #my $this_sub = 'getCertID';
1751              
1752             my $self = shift;
1753              
1754             # Validation
1755             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
1756              
1757              
1758             # Return success to the caller.
1759             return($self->{cert_id});
1760              
1761             }# end sub getCertID()
1762              
1763              
1764              
1765              
1766             =head2 setSiteID()
1767              
1768             Instance method to set the site id for the current session. This will override
1769             any global setting of the site id that was set at the package level by the
1770             environment variable $ENV{EBAY_API_SITE_ID}, or when a Session object is
1771             first constructed.
1772              
1773             Arguments:
1774              
1775             =over 4
1776              
1777             =item *
1778              
1779             Object reference of type eBay::API.
1780              
1781             =item *
1782              
1783             Scalar site id.
1784              
1785             =back
1786              
1787             Returns:
1788              
1789             =over 4
1790              
1791             =item *
1792              
1793             B Site id given as argument.
1794              
1795             =item *
1796              
1797             B undefined
1798              
1799             =back
1800              
1801              
1802             =cut
1803              
1804              
1805              
1806              
1807             sub setSiteID ($$;) {
1808             my ($self, $site_id) = @_;
1809              
1810             # Validation
1811             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
1812             eBay::API::BaseApi::_check_arg($site_id, Params::Validate::SCALAR);
1813              
1814              
1815             $self->{site_id} = $site_id;
1816             return $site_id;
1817             }
1818              
1819              
1820              
1821              
1822             =head2 getSiteID()
1823              
1824             Returns the current site id for the current session. Note that this may
1825             be different than the global site id for the package.
1826              
1827             Arguments:
1828              
1829             =over 4
1830              
1831             =item *
1832              
1833             Object reference of type eBay::API.
1834              
1835             =back
1836              
1837             Returns:
1838              
1839             =over 4
1840              
1841             =item *
1842              
1843             B Site id given for the current session.
1844              
1845             =item *
1846              
1847             B undefined
1848              
1849             =back
1850              
1851              
1852             =cut
1853              
1854              
1855              
1856             sub getSiteID ($;) {
1857             my $self = shift;
1858             # Validation
1859             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
1860              
1861             return $self->{site_id};
1862             }
1863              
1864              
1865              
1866             =head2 setUserName()
1867              
1868             Instance method to set the application user name for the current
1869             session. This will override any global setting of the user name that
1870             was set at the package level by the environment variable
1871             $ENV{EBAY_API_USER_NAME}, or when a Session object is first
1872             constructed.
1873              
1874             Arguments:
1875              
1876             =over 4
1877              
1878             =item *
1879              
1880             Object reference of type eBay::API.
1881              
1882             =item *
1883              
1884             Scalar user name.
1885              
1886             =back
1887              
1888             Returns:
1889              
1890             =over 4
1891              
1892             =item *
1893              
1894             B User name given as argument.
1895              
1896             =item *
1897              
1898             B undefined
1899              
1900             =back
1901              
1902              
1903             =cut
1904              
1905              
1906              
1907              
1908             sub setUserName ($$;) {
1909             my ($self, $user_name) = @_;
1910              
1911             # Validation
1912             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
1913              
1914             $self->{user_name} = $user_name;
1915             return $user_name;
1916             }
1917              
1918             =head2 getUserName()
1919              
1920             Returns the current application user name for the current session.
1921             Note that this may be different than the global user name for the
1922             package.
1923              
1924             Arguments:
1925              
1926             =over 4
1927              
1928             =item *
1929              
1930             Object reference of type eBay::API.
1931              
1932             =back
1933              
1934             Returns:
1935              
1936             =over 4
1937              
1938             =item *
1939              
1940             B User name given for the current session.
1941              
1942             =item *
1943              
1944             B undefined
1945              
1946             =back
1947              
1948              
1949             =cut
1950              
1951              
1952              
1953             sub getUserName ($;) {
1954             my $self = shift;
1955              
1956             # Validation
1957             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
1958              
1959             return $self->{user_name};
1960             }
1961              
1962              
1963             #########
1964              
1965              
1966              
1967             =head2 setUserPassword()
1968              
1969             Instance method to set the application user password for the current
1970             session. This will override any global setting of the user password that
1971             was set at the package level by the environment variable
1972             $ENV{EBAY_API_USER_PASSWORD}, or when an API object is first
1973             constructed.
1974              
1975             Arguments:
1976              
1977             =over 4
1978              
1979             =item *
1980              
1981             Object reference of type eBay::API.
1982              
1983             =item *
1984              
1985             Scalar user password.
1986              
1987             =back
1988              
1989             Returns:
1990              
1991             =over 4
1992              
1993             =item *
1994              
1995             B User password given as argument.
1996              
1997             =item *
1998              
1999             B undefined
2000              
2001             =back
2002              
2003              
2004             =cut
2005              
2006              
2007              
2008              
2009             sub setUserPassword ($$;) {
2010             my ($self, $user_password) = @_;
2011              
2012             # Validation
2013             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
2014             eBay::API::BaseApi::_check_arg($user_password, Params::Validate::SCALAR);
2015              
2016             $self->{user_password} = $user_password;
2017             return $user_password;
2018             }
2019              
2020             =head2 getUserPassword()
2021              
2022             Returns the current application user password for the current session.
2023             Note that this may be different than the global user password for the
2024             package.
2025              
2026             Arguments:
2027              
2028             =over 4
2029              
2030             =item *
2031              
2032             Object reference of type eBay::API.
2033              
2034             =back
2035              
2036             Returns:
2037              
2038             =over 4
2039              
2040             =item *
2041              
2042             B User password given for the current session.
2043              
2044             =item *
2045              
2046             B undefined
2047              
2048             =back
2049              
2050              
2051             =cut
2052              
2053              
2054              
2055             sub getUserPassword ($;) {
2056             my $self = shift;
2057              
2058             # Validation
2059             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
2060              
2061             return $self->{user_password};
2062             }
2063              
2064              
2065              
2066             # Deprecated
2067             #=pod
2068             #
2069             #=head2 setErrLang()
2070             #
2071             #Local setter method for setting the class attribute $EBAY_ERR_LANG.
2072             #This variable is set to default to the value of
2073             #$ENV{EBAY_API_XML_ERR_LANG}. If you want to override the value, make
2074             #sure to use this method before object instantiation.
2075             #
2076             #Arguments:
2077             #
2078             #=over 4
2079             #
2080             #=item *
2081             #
2082             #Scalar representing the desired locale representation of the error
2083             #language you would like to have returned to you from XML responses.
2084             #
2085             #=back
2086             #
2087             #Returns:
2088             #
2089             #=over 4
2090             #
2091             #=item *
2092             #
2093             #B The value of $EBAY_ERR_LANG (should be the same value that
2094             #was provided by the user)
2095             #
2096             #=item *
2097             #
2098             #B undefined
2099             #
2100             #=back
2101             #
2102             #=cut
2103             #
2104             #
2105             #
2106             #
2107             # sub setErrLang($$;) {
2108             #
2109             # # Get all values passed in.
2110             # my($self, $errlang) = @_;
2111             #
2112             # # Validation of the existence of the argument is done implicitly via the sub prototype.
2113             # # Validation
2114             # eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
2115             # eBay::API::BaseApi::_check_arg($errlang, Params::Validate::SCALAR);
2116             #
2117             # # Set the api error language
2118             # $self->{err_lang} = $errlang;
2119             #
2120             # # Return success to the caller.
2121             # return($errlang);
2122             #
2123             # }# end sub setErrLang()
2124              
2125              
2126              
2127              
2128             # Deprecated
2129             #=pod
2130             #
2131             #=head2 getErrLang()
2132             #
2133             #Local getter method for getting the current value of $EBAY_ERR_LANG.
2134             #
2135             #Arguments: none
2136             #
2137             #Returns:
2138             #
2139             #=over 4
2140             #
2141             #=item *
2142             #
2143             #B The value of $EBAY_ERR_LANG
2144             #
2145             #=item *
2146             #
2147             #B undefined
2148             #
2149             #=back
2150             #
2151             #=cut
2152             #
2153             #
2154             #
2155             # sub getErrLang($;) {
2156             #
2157             # my $self = shift;
2158             #
2159             # # Validation
2160             # eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
2161             #
2162             # # Return success to the caller.
2163             # return($self->{err_lang});
2164             #
2165             # }# end sub getErrLang()
2166              
2167              
2168              
2169              
2170              
2171              
2172              
2173              
2174              
2175             # _setError()
2176             #
2177             # Description:
2178             #
2179             # Private instance setter method for setting the latest
2180             # error message encountered during an eBay API call.
2181             #
2182             # Access: private
2183             #
2184             # Arguments: Reference to an object of type eBay::API
2185             #
2186             # Returns: Error message being set
2187              
2188             sub _setError($$;) {
2189              
2190             # Local Variables
2191             my $this_sub = '_setError'; # Used for logging
2192              
2193             # Get values passed in
2194             my($obj, $error) = @_;
2195              
2196             # Validate arguments
2197             # Argument existence enforced from sub prototype.
2198              
2199             # Validation
2200             eBay::API::BaseApi::_check_arg($obj, Params::Validate::OBJECT);
2201             eBay::API::BaseApi::_check_arg($error, Params::Validate::SCALAR);
2202              
2203             # Set the error
2204             $ERROR = $obj->{error} = $error;
2205              
2206             # Return success to the caller.
2207             return($ERROR);
2208              
2209             }# end sub _setError()
2210              
2211              
2212              
2213             =head2 getError()
2214              
2215             Instance getter method for retrieving the generic error for currrent
2216             state of the session. Consult the other information such as the logs,
2217             or the status of other api objects such as api call objects for more
2218             detailed error information. If all requests have completed
2219             successfully, there will be no error information. If any of the
2220             requests have had an error, then there will some message to this
2221             effect.
2222              
2223             Arguments:
2224              
2225             =over 4
2226              
2227             =item *
2228              
2229             Reference to an object of type eBay::API.
2230              
2231             =back
2232              
2233             Returns:
2234              
2235             =over 4
2236              
2237             =item *
2238              
2239             B: Last error encountered during while executing an eBay::API
2240             call. undef if no errors were encountered.
2241              
2242             Note: An empty error value can return this as well, which in this case
2243             would be success.
2244              
2245             =back
2246              
2247             =cut
2248              
2249             sub getError($;) {
2250              
2251             # Get values passed in
2252             my($obj) = @_;
2253              
2254             # Validation
2255             eBay::API::BaseApi::_check_arg($obj, Params::Validate::OBJECT);
2256              
2257             # If we pass validation, return success to the caller.
2258             return( $obj->{error} || undef() );
2259              
2260             }# end sub getError()
2261              
2262              
2263              
2264              
2265              
2266             =head2 isSuccess()
2267              
2268             Indicates B status of the eBay::API object (usually a
2269             session, or an API call itself). Call this after execute() to see if
2270             errors were encountered.
2271              
2272             Arguments: none
2273              
2274             Returns:
2275              
2276             =over 4
2277              
2278             =item *
2279              
2280             B Boolean true if all reponses for the request(s) were returned
2281             without problems by the eBay API.
2282              
2283             =item *
2284              
2285             B Boolean false if there was either a general problem with
2286             getting response(s) back from the eBay API, or if there was a failure on
2287             one or more of the bundled request. Consult the error status of each
2288             response for more information.
2289              
2290             =back
2291              
2292             =cut
2293              
2294              
2295             sub isSuccess($;) {
2296             my $obj = shift;
2297              
2298             # Validation
2299             eBay::API::BaseApi::_check_arg($obj, Params::Validate::OBJECT);
2300              
2301             return (defined $obj->{error} && $obj->{error}) ? 1 : 0;
2302             }
2303              
2304              
2305              
2306              
2307             =head2 setAuthToken()
2308              
2309             Instance method to set the application user auth token for the current
2310             session. This will override any global setting of the user auth token that
2311             was set at the package level by the environment variable
2312             $ENV{EBAY_API_AUTH_TOKEN}, or when an API object is first
2313             constructed.
2314              
2315             Arguments:
2316              
2317             =over 4
2318              
2319             =item *
2320              
2321             Object reference of type eBay::API.
2322              
2323             =item *
2324              
2325             Scalar user auth token.
2326              
2327             =back
2328              
2329             Returns:
2330              
2331             =over 4
2332              
2333             =item *
2334              
2335             B User auth token given as argument.
2336              
2337             =item *
2338              
2339             B undefined
2340              
2341             =back
2342              
2343              
2344             =cut
2345              
2346              
2347              
2348              
2349             sub setAuthToken ($$;) {
2350             my ($self, $user_auth_token) = @_;
2351              
2352             # Validation
2353             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
2354              
2355              
2356             $self->{user_auth_token} = $user_auth_token;
2357             return $user_auth_token;
2358             }
2359              
2360              
2361              
2362             =head2 getAuthToken()
2363              
2364             Returns the current application user auth token for the current session.
2365             Note that this may be different than the global user auth token for the
2366             package.
2367              
2368             Arguments:
2369              
2370             =over 4
2371              
2372             =item *
2373              
2374             Object reference of type eBay::API.
2375              
2376             =back
2377              
2378             Returns:
2379              
2380             =over 4
2381              
2382             =item *
2383              
2384             B User auth token given for the current session.
2385              
2386             =item *
2387              
2388             B undefined
2389              
2390             =back
2391              
2392              
2393             =cut
2394              
2395              
2396              
2397             sub getAuthToken ($;) {
2398             my $self = shift;
2399              
2400             # Validation
2401             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
2402              
2403              
2404             return $self->{user_auth_token};
2405             }
2406              
2407              
2408              
2409              
2410              
2411             =head2 setCompatibilityLevel()
2412              
2413             Instance method to set the XML API compatibility level for the current
2414             session. This will override any global default setting at the package
2415             level.
2416              
2417             Note that the compatibility level is defaulted with each release of
2418             the API. However you can override that default with the environment
2419             variable, $ENV{EBAY_API_COMPATIBILITY_LEVEL}, when you construct a
2420             session object, or by using this setter method.
2421              
2422              
2423             Arguments:
2424              
2425             =over 4
2426              
2427             =item *
2428              
2429             Object reference of type eBay::API.
2430              
2431             =item *
2432              
2433             Scalar compatibility level.
2434              
2435             =back
2436              
2437             Returns:
2438              
2439             =over 4
2440              
2441             =item *
2442              
2443             B Compatibility level given as argument.
2444              
2445             =item *
2446              
2447             B undefined
2448              
2449             =back
2450              
2451              
2452             =cut
2453              
2454              
2455              
2456              
2457             sub setCompatibilityLevel ($$;) {
2458             my ($self, $level) = @_;
2459              
2460             # Validation
2461             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
2462             eBay::API::BaseApi::_check_arg($level, Params::Validate::SCALAR);
2463              
2464             $self->{compatibility_level} = $level;
2465             return $level;
2466             }
2467              
2468             =head2 getCompatibilityLevel()
2469              
2470             Returns the XML API compatibility level for the current session. Note that this may
2471             be different than the global default for the package.
2472              
2473             Arguments:
2474              
2475             =over 4
2476              
2477             =item *
2478              
2479             Object reference of type eBay::API.
2480              
2481             =back
2482              
2483             Returns:
2484              
2485             =over 4
2486              
2487             =item *
2488              
2489             B Compatibility level for the current session.
2490              
2491             =item *
2492              
2493             B undefined
2494              
2495             =back
2496              
2497              
2498             =cut
2499              
2500              
2501              
2502             sub getCompatibilityLevel ($;) {
2503             my $self = shift;
2504              
2505             # Validation
2506             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
2507              
2508             return $self->{compatibility_level};
2509             }
2510              
2511              
2512              
2513              
2514             =head2 setVersion()
2515              
2516             Instance method to set the api version to something other than the default value, or the
2517             value specified when an eBay::API object was instantiated.
2518              
2519             Arguments:
2520              
2521             =over 4
2522              
2523             =item *
2524              
2525             Reference to an object of type eBay::API.
2526              
2527             =item *
2528              
2529             Scalar representing the version of the the eBay webservices API you
2530             wish to use.
2531              
2532             =back
2533              
2534             Returns:
2535              
2536             =over 4
2537              
2538             =item *
2539              
2540             B The value of API version (should be the same value
2541             that was provided by the user)
2542              
2543             =item *
2544              
2545             B undefined
2546              
2547             =back
2548              
2549             =cut
2550              
2551              
2552              
2553             sub setVersion($$;) {
2554              
2555             # Get all values passed in.
2556             my($self, $apiver) = @_;
2557              
2558             # Validation of the existence of the argument is done implicitly via the sub prototype.
2559             # Validation
2560             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
2561             eBay::API::BaseApi::_check_arg($apiver, Params::Validate::SCALAR);
2562              
2563             # Set the proxy
2564             $self->{api_ver} = $apiver;
2565              
2566             # Return success to the caller.
2567             return($apiver);
2568              
2569             }# end sub setVersion()
2570              
2571              
2572              
2573             =head2 getVersion()
2574              
2575             Instance getter method for getting the current ebay api version level
2576             to be used.
2577              
2578             Arguments:
2579              
2580             =over 4
2581              
2582             =item *
2583              
2584             Reference to an object of type eBay::API.
2585              
2586             =back
2587              
2588             Returns:
2589              
2590             =over 4
2591              
2592             =item *
2593              
2594             B The value of the current ebay api version to be used.
2595              
2596             =item *
2597              
2598             B undefined
2599              
2600             =back
2601              
2602             =cut
2603              
2604             sub getVersion($;) {
2605              
2606             my $self = shift;
2607              
2608             # Validation
2609             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
2610              
2611             # Return success to the caller.
2612             return $self->{api_ver};
2613              
2614             }# end sub getVersion()
2615              
2616              
2617              
2618              
2619             =head2 setCompression()
2620              
2621             Enables/disables compression in the HTTP header. This tells the API
2622             whether the client application can accept gzipped content or not.
2623             Do not set this unless you have CPAN module Compress::Zlib.
2624              
2625             Arguments:
2626              
2627             =over 4
2628              
2629             =item *
2630              
2631             A reference to object of type eBay::API.
2632              
2633             =item *
2634              
2635             Boolean value (0 = false; non-zero = true);
2636              
2637             =back
2638              
2639             Returns:
2640              
2641             =over 4
2642              
2643             =item *
2644              
2645             The boolean value to be set for this attribute.
2646              
2647             =back
2648              
2649             =cut
2650              
2651              
2652              
2653              
2654             sub setCompression($$;) {
2655             my $self = shift;
2656             my $bool = shift;
2657              
2658             # Validation
2659             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
2660             eBay::API::BaseApi::_check_arg($bool, Params::Validate::BOOLEAN);
2661              
2662             $self->{compression} = $bool;
2663             return $bool;
2664             }
2665              
2666              
2667             =head2 isCompression()
2668              
2669             Indicates if gzip compression has been requested from the API.
2670              
2671             Arguments:
2672              
2673             =over 4
2674              
2675             =item *
2676              
2677             A reference to an object of type eBay::API.
2678              
2679             =back
2680              
2681             Returns:
2682              
2683             =over 4
2684              
2685             =item *
2686              
2687             True if compression is enabled; false if it is not
2688              
2689             =back
2690              
2691             =cut
2692              
2693              
2694              
2695             sub isCompression($;) {
2696             my $self = shift;
2697              
2698             # Validation
2699             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
2700              
2701             return $self->{compression};
2702             }
2703              
2704             =pod
2705              
2706             =head2 setTimeout()
2707              
2708             Call this instance method to set the number of seconds a session or a call should wait
2709             for the eBay XML API web services to respond to a request. This parameter
2710             controls the behavior of the call retry logic.
2711              
2712             Arguments:
2713              
2714             =over 4
2715              
2716              
2717             =item *
2718              
2719             The name of this class/package.
2720              
2721             =item *
2722              
2723             (Required) A scalar integer value indicating the number of seconds to
2724             wait for a web service request to return with a response.
2725              
2726             =back
2727              
2728             Returns:
2729              
2730             =over 4
2731              
2732             =item *
2733              
2734             Undefined.
2735              
2736             =back
2737              
2738             =cut
2739              
2740              
2741             sub setTimeout($$;) {
2742             my $self = shift;
2743             # Validation
2744             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
2745             $self->{'timeout'} = shift;
2746             }
2747              
2748              
2749             =pod
2750              
2751             =head2 getTimeout()
2752              
2753             Call this instance method to get the number of seconds a session or a call should wait
2754             for the eBay XML API web services to respond to a request. This parameter
2755             controls the behavior of the call retry logic.
2756              
2757             Arguments:
2758              
2759             =over 4
2760              
2761              
2762             =item *
2763              
2764             The name of this class/package.
2765              
2766             =back
2767              
2768             Returns:
2769              
2770             =over 4
2771              
2772             =item *
2773              
2774             The number of seconds the call or session should currently wait for a response
2775             from a web service.
2776              
2777             =back
2778              
2779             =cut
2780              
2781              
2782             sub getTimeout($;) {
2783             my $self = shift;
2784             # Validation
2785             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
2786             return $self->{'timeout'};
2787             }
2788              
2789              
2790             =pod
2791              
2792             =head2 setCallRetry()
2793              
2794             Call this instance method to set the number of times a session or a call should
2795             retry an eBay XML API web service before giving up. This parameter
2796             controls the behavior of the call retry logic.
2797              
2798             Arguments:
2799              
2800             =over 4
2801              
2802              
2803             =item *
2804              
2805             The name of this class/package.
2806              
2807             =item *
2808              
2809             (Required) A reference to an object of type eBay::API::XML::CallRetry. This
2810             object contains parameters controlling how to retry a call if there is an
2811             error, including number of times to retry, delay in milliseconds between retries,
2812             a list of errors that will permit a retry. See CallRetry documentation
2813             for more details.
2814              
2815             =back
2816              
2817             Returns:
2818              
2819             =over 4
2820              
2821             =item *
2822              
2823             Undefined.
2824              
2825             =back
2826              
2827             =cut
2828              
2829              
2830             sub setCallRetry($$;) {
2831             my $self = shift;
2832             # Validation
2833             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
2834             $self->{'callRetry'} = shift;
2835             }
2836              
2837              
2838             =pod
2839              
2840             =head2 getCallRetry()
2841              
2842             Call this instance method to get any eBay::API::XML::CallRetry object
2843             that has previously been set to control retry behavior.
2844              
2845             Arguments:
2846              
2847             =over 4
2848              
2849              
2850             =item *
2851              
2852             The name of this class/package.
2853              
2854             =back
2855              
2856             Returns:
2857              
2858             =over 4
2859              
2860             =item *
2861              
2862             The number of times the call or session should currently retry for a response
2863             from a web service.
2864              
2865             =back
2866              
2867             =cut
2868              
2869              
2870             sub getCallRetry($;) {
2871             my $self = shift;
2872             # Validation
2873             eBay::API::BaseApi::_check_arg($self, Params::Validate::OBJECT);
2874             return $self->{'callRetry'};
2875             }
2876              
2877              
2878             =pod
2879              
2880             =head2 getApiReleaseNumber()
2881              
2882             Modifier: static
2883             Access: public
2884             Note: Returns the SDK's release number
2885              
2886             =cut
2887              
2888             sub getApiReleaseNumber() {
2889             return eBay::API::XML::Release::RELEASE_NUMBER;
2890             }
2891              
2892             # _check_arg()
2893              
2894             # Protected package method to validate arguments to subroutines. Uses
2895             # CPAN module Params::Validate. Will throw exceptions if parameters
2896             # are not correct.
2897              
2898             # Returns false if the parameter check occurred and it failed; otherwise
2899             # returns true.
2900              
2901             sub _check_arg ($$;) {
2902             if ($CHECK_PARAMETERS) {
2903             my $argvalue = shift;
2904             my $argtype = shift;
2905             my @args;
2906             push(@args, $argvalue);
2907             eval {
2908             validate_pos(@args, { type => $argtype });
2909             };
2910             if ($@) {
2911             my ($package, $filename, $line) = caller;
2912             $argvalue = (defined $argvalue) ? $argvalue : 'null';
2913             ebay_throw eBay::API::UsageException(error => 'Invalid argument type: ' . $argvalue,
2914             package => $package,
2915             file => $filename,
2916             line => $line);
2917             return 0;
2918             }
2919             }
2920             return 1;
2921             }
2922              
2923              
2924             =pod
2925              
2926             =head2 enableParameterChecks()
2927              
2928             Public package method to enable run-time validation of arguments to
2929             subroutines in the eBay::API package. Checking is enabled by default,
2930             but you may want to disable checking in production to reduce overhead.
2931             Having checking enabled is probably most useful during development of
2932             your application.
2933              
2934             This method is both a getter and a setter.
2935              
2936             Usage:
2937              
2938              
2939             if (eBay::API::BaseApi::enableParameterChecks()) {
2940             eBay::API::BaseApi::enableParameterChecks(0);
2941             }
2942              
2943             Arguments:
2944              
2945             =over 4
2946              
2947             =item *
2948              
2949             (Optional) A scalar boolean value to enable (non-zero) or disable (0)
2950             run-time parameter checking in the eBay::API package.
2951              
2952             =back
2953              
2954             Returns:
2955              
2956             =over 4
2957              
2958             =item *
2959              
2960             True if checking is enabled; false if it is not.
2961              
2962             =back
2963              
2964             =cut
2965              
2966             sub enableParameterChecks(;$) {
2967             my $bool = shift;
2968             if (defined $bool) {
2969             $CHECK_PARAMETERS = $bool;
2970             }
2971             return $CHECK_PARAMETERS;
2972             }
2973              
2974             1;