| Myco documentation | view source | Contained in the Myco distribution. |
Myco::Entity::SampleEntityAddress - Myco Addresses.
use Myco::User; # Constructors. my $addr = Myco::Entity::SampleEntityAddress->new; # See Myco::Entity for more. # Instance Methods. my $address_key = $addr->get_address_key; $addr->set_address_key($address_key); my $street = $addr->get_street; $addr->set_street($street); my $city = $addr->get_city; $addr->set_city($city); my $state = $addr->get_state; $addr->set_state($state); my $zip = $addr->get_zip; $addr->set_zip($zip); my $country = $addr->get_country; $addr->set_country($country); $addr->save; $addr->destroy;
This class, along with Myco::Entity::SampleEntityBase and Myco::Entity::SampleEntityAddress, provide the basis for all tests provided with the core myco system.
Objects of this class represent addresses in Myco - in fact, the entire class is a ripoff of Myco::Address. In addition to the typical address parts each also has a value called "address_key". This value must be unique across all addresses for a given person, though different persons can have the same address_key.
See Myco::Entity.
Attributes may be initially set during object construction (with new()) but
otherwise are accessed solely through accessor methods. Typical usage:
set
$obj->set_attr($value);
This method sets the value of the "attr" attribute. These methods, implemented
by Class::Tangram, perform data validation. If there is any
concern that the set method might be called with invalid data then the call
should be wrapped in an eval block to catch exceptions that would result.
get
$value = $obj->get_attr;
This method returns the value of the "attr" attribute.
A listing of available attributes follows:
type: string(32) default value: 'home'
A short descripter that uniquely describes an address on a per-person bases. All addresses associated with a single person must have different address_keys, but different people can have the same address_key. The address_key is stored internally in lowercase, so address_key matches are case-insensitive.
type: string(159)
The street portion of the address. May be multiple lines by using new line characters.
type: string(128)
The address city.
type: string(2)
The address state or province.
type: string(16)
The address postal code.
type: string(64)
The address country. preferrably specified as an ISO 3166-1 two-letter code.
Copyright (c) 2006 the myco project. All rights reserved. This software is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
David Wheeler <david@wheeler.net>
Myco::Entity, Tangram, Class::Tangram, Lingua::Strfname (Lingua::Strname).
| Myco documentation | view source | Contained in the Myco distribution. |