Jeff Nokes > eBay-API-0.22 > eBay::API::XML::BaseDataType

Download:
eBay-API-0.22.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  0
View/Report Bugs
Module Version: 0.01   Source   Latest Release: eBay-API-0.25

Subroutines: ^

new()

serialize()

deserialize()

parameters:

   1. rhXmlSimple    - Data structure created by parsing an XML str with
                       XML::Simple

   2. recursionLevel - Level of recursion, this is an optional argument
                       and it is used for debuging purposes only. 
                       If constant DISPLAY_RECURSION is set to 1, 
                       recursionLevel is used to pretty print the output
                       tracing the recursion.

   3. sRawXmlString  - XML string used to set objects properties. The string is
                       first parsed by XML::Simple. Data structure that is 
                       received after parsing is used to populate object's
                       properties (it overrides 'rhXmlSimple' parameter). 
                       'sRawXmlString' parameter should be used for test 
                       purposes only!!

_formatScalarIfNeeded

Access level: private

1. 'xs:boolean'

XML schema API calls for boolean values return 'true' and 'false'. During deserilization we convert API boolean values to perl's boolean values:

    1 (true) and 0 (false).

2. XML:Simple parses empty tags into a hash reference?!?! <Location> </Location> converted into 'Location' => {}

convertArray_To_RefToArrayIfNeeded()

Some DataType setters set reference to an array and this function is used in such setters to convert passed paremeter to 'a reference to an array' if one is not passed.

Example:

     DataType: FeesType.pm has 'setFee' setter. This setter expects 
               a reference to an array to be passed.

Still, we will support 3 types of parameters:

  1. parameter is a reference to an array, no conversion (just as should be)

  2. parameter is an array, convert it to a reference to an array

  3. parameter is a scalar, create an array with one element and
         then create a reference to that array

This method is used in setters that expect a parameter of 'a reference to an array' type

The generated setters look like the following one:

 sub setProperty {
    my $self = shift;
    $self->{'property'} = $self->convertArray_To_RefToArrayIfNeeded(@_);
 }

_getDataTypeInstance()

Used in getters that return a BaseDataType object. If the object is not defined, it instantiate it.

This allows the following syntax:

     my $sSellerId = $pItem->getSeller()->getUserID();

Otherwise we would have to write something like this:

     my $pSeller = $pItem->getSeller();
     if ( defined $pSeller ) {
        $SellerId = $pSeller->getUserID();
     }

_getDataTypeArray()

Used in getters that return an array.

If the array is not defined instantiate it.

Internally all arrays are stored as references to an array. Depending on calling context, this method returns either an array or a reference to an array, which means we can use both of the following syntaxes:

 my $ra = $pType->_getDataTypeArray();  # returns a ref to an array
 my @a = $pType->_getDataTypeArray();   # returns an array

isEmpty()

Returns:

        1 - If hash containing object properties is empty.

        0 - If hash conatining object properties is not empty

Basically this means that:

        "scalar (keys @$self )" returns 0

        or "scalar %$self" returns 1
syntax highlighting: