Basset
view release on metacpan or search on metacpan
lib/Basset/Object.pm view on Meta::CPAN
#do something with static argument
.
.
}
};
All easy enough. Refer to any subclasses of this class for further examples.
Basset::Object includes two other alternate accessors for you - regex and private.
Some::Class->add_attr(['user_id', '_isa_regex_accessor', qr{^\d+$}, "Error - user_id must be a number", "NaN"]);
The arguments to it are, respectively, the name of the attribute, the internal accessor used, the regex used to validate, the error message to return, and the error code to return.
If you try to mutate with a value that doesn't match the regex, it'll fail.
Some::Class->add_attr(['secret', '_isa_private_accessor']);
private accessors add a slight degree of security. All they do is simply restrict access to the attribute unless you are within the class of the object. Note, that this causes
access to automatically trickle down into subclasses.
=cut
( run in 0.379 second using v1.01-cache-2.11-cpan-fd5d4e115d8 )