Acme-Sub-Parms
view release on metacpan or search on metacpan
examples/object_use_example.pl view on Meta::CPAN
sub other_thing { return shift->_property('other_thing', @_); }
###
#########################################
# Simple generic get/set utility method
# Expects either 1 or 2 parameters.
#
# If passed a single string value, returns the associated instance value
#
# If passed a string and a second parameter, sets the the associated instance value to the value of the
# second parameter.
#
sub _property {
my $self = shift;
my $package = __PACKAGE__;
my $property_id = shift;
if (0 == @_) {
return $self->{$package}->{$property_id};
} elsif (1 == @_) {
$self->{$package}->{$property_id} = $_[0];
return $_[0];
lib/Acme/Sub/Parms.pod view on Meta::CPAN
=head1 Parameter Validation
=over 4
=item Optional/Required Parameters
Optional vs Required is flagged by either (surprise) B<optional> or
B<required> in the parameter options declaration.
The parameter options declaration is the section between the '[' and ']'
characters after the name of field being bound.
# Optional parameter
BindParms : (
my $handle : handle [optional];
)
# Required parameter
BindParms : (
my $handle : handle [required];
( run in 1.402 second using v1.01-cache-2.11-cpan-39bf76dae61 )