NAME

Object::eBay::Currency - Represents a currency used by eBay

VERSION

This documentation refers to Object::eBay::Currency version 0.0.2

SYNOPSIS

# assuming that $item is an Object::eBay::Item object
my $price = $item->selling_status->current_price;

# supports string and numeric context
print "Going for $price\n";          # "Going for USD12.99"
print "Bargain!\n" if $price < 20;   # numeric context

# accessor methods are also available
my $currency_id = $price->currency_id; # just the currency ID
my $value       = $price->value;       # same as numeric context
my $string      = $price->as_string;   # same as string context

DESCRIPTION

Many of eBay's API calls return values which represent an amount of a particular currency. Item prices are a good example. An Object::eBay::Currency object represents a particular quantity of a particular currency. Methods throughout Object::eBay return Currency objects where appropriate.

As mentioned in the "SYNOPSIS" both string and numeric context are supported. In numeric context, the object evaluates to the amount of currency represented. In string context, the object evaluates to a string which represents the currency and the quantity both (see "as_string" for details).

METHODS

as_string

Returns a string representation of the currency amount. The string is produced by concatenating the currency ID with the quantity. For example 10 U.S. Dollars is represented as 'USD10.00' You may not be able to rely on the decimal behavior demonstrated in that example.

This method provides the value for string context.

currency_id

Returns a string identifying the type of currency this object represents. The possible values are determined by eBay.

value

Returns the quantity of currency represented by this object. It's generally a bad idea to use this method unless you already know the type of currency. For example, if the return value is '10', that could mean 10 U.S. Dollars or 10 Euros.

This method provides the value for numeric context.

DIAGNOSTICS

Missing 'content' and/or 'currencyID'

This exception is thrown when trying to construct a Currency object from an invalid hashref. This indicates a problem (or change) with eBay's XML response.

CONFIGURATION AND ENVIRONMENT

Object::eBay::Currency requires no configuration files or environment variables.

DEPENDENCIES

  • Class::Std

INCOMPATIBILITIES

None known.

BUGS AND LIMITATIONS

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

SUPPORT

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

perldoc Object::eBay;

You can also look for information at:

ACKNOWLEDGEMENTS

AUTHOR

Michael Hendricks <michael@ndrix.org>

LICENSE AND COPYRIGHT

Copyright (c) 2006 Michael Hendricks (<michael@ndrix.org>). All rights reserved.

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