Mango::Product - Module representing a product
my $product = $provider->get_by_sku('ABC-123'); print $product->created; my $attributes = $product->attributes; while (my $attribute = $attributes->next) { print $attribute->name, ': ', $attribute->value; };
Mango::Product represents a product to be sold.
Same as "add_attributes".
Adds an attribute to the current product. atttributes may be hashes containing name/value data, or Mango::Attribute objects;
atttributes
$product->add_attributes( {name => 'Color', value => 'red'}, $attributeobject );
Same as "add_tag".
Adds tags to the current product. tags may be tag strings, or Mango::Tag objects:
tags
$product->add_tags( 'computers', $tagobject );
Returns a list of attributes for the current product in list context, or a Mango::Iterator in scalar context.
my @attributes = $product->attributes({ name => 'A%' }); my $iterator = $product->attributes({ name => 'A%' });
Returns the date and time in UTC the product was created as a DateTime object.
print $profile->created;
Sames as "delete_attributes".
Deletes attributes from the current product matching the supplied filter..
$product->delete_attributes({ name => 'Color' });
Sames as "delete_tags".
Deletes tags from the current product matching the supplied filter..
$product->delete_tags({ 'computer' });
Gets/sets the description of the current product.
print $product->description;
Deletes the current profile.
Returns the id of the current product.
print $product->id;
Gets/sets the name of the current product.
print $product->name;
Gets/sets the price of the current product. The price is returned as a Mango::Currency object.
print $product->price;
Gets/sets the sku/part number of the current product.
print $product->sku;
Returns a list of tags for the current product in list context, or a Mango::Iterator in scalar context.
my @tags = $product->tags({ name => 'A%' }); my $iterator = $product->tags({ name => 'A%' });
Saves any changes made to the product back to the provider.
$product->password('Red'); $product->update;
Whenever "update" is called, "updated" is automatically set to the current time in UTC.
Returns the date and time in UTC the product was last updated as a DateTime object.
print $product->updated;
Mango::Object, Mango::Provider::Profiles
Christopher H. Laco CPAN ID: CLACO claco@chrislaco.com http://today.icantfocus.com/blog/
To install Mango, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mango
CPAN shell
perl -MCPAN -e shell install Mango
For more information on module installation, please visit the detailed CPAN module installation guide.