- associative
-
Boolean flag. States that the returned attribute must be unique, associative
MULTI
. Defaults to 0. Only makes sense iftype
is MULTI and unique is true. - method_key
-
Boolean flag. States that the returned attribute must be unique, associative
MULTI
. Defaults to 0. Only makes sense iftype
is MULTI and unique is true. - ordered
-
Boolean flag. States that the returned attribute must be an ordered list. Defaults to 0. Only makes sense if
type
is MULTI. - type
-
If
type
is BOOLEAN aPerlBean::Attribute::Boolean
, on SINGLE aPerlBean::Attribute::Single
and on MULTI aPerlBean::Attribute::Multi
is returned. Defaults to 'SINGLE'. NOTE: type has precedence over ordered and unique. - unique
-
Boolean flag. States that the items in the
MULTI
attribute must be unique. Defaults to 0. Only makes sense iftype
is MULTI.
Options for OPT_HASH_REF
passed to package PerlBean::Attribute
may include:
default_value
-
Passed to set_default_value().
exception_class
-
Passed to set_exception_class(). Defaults to 'Error::Simple'.
mandatory
-
Passed to set_mandatory(). Defaults to 0.
method_base
-
Passed to set_method_base().
method_factory_name
-
Passed to set_method_factory_name(). Mandatory option.
perl_bean
-
Passed to set_perl_bean().
short_description
-
Passed to set_short_description().
Options for OPT_HASH_REF
passed to package PerlBean::Attribute::Single
may include:
allow_empty
-
Passed to set_allow_empty(). Defaults to 1.
allow_isa
-
Passed to set_allow_isa(). Must be an
ARRAY
reference. allow_ref
-
Passed to set_allow_ref(). Must be an
ARRAY
reference. allow_rx
-
Passed to set_allow_rx(). Must be an
ARRAY
reference. allow_value
-
Passed to set_allow_value(). Must be an
ARRAY
reference.
# Switch attribute type
if ( ! defined(\$opt->{type} ) || \$opt->{type} eq 'SINGLE') {
require PerlBean::Attribute::Single;
return( PerlBean::Attribute::Single->new(\$opt) );
}
elsif ( \$opt->{type} eq 'BOOLEAN' ) {
require PerlBean::Attribute::Boolean;
return( PerlBean::Attribute::Boolean->new(\$opt) );
}
elsif ( \$opt->{type} eq 'MULTI' ) {
if ( \$opt->{unique} ) {
if ( \$opt->{ordered} ) {
require PerlBean::Attribute::Multi::Unique::Ordered;
return( PerlBean::Attribute::Multi::Unique::Ordered->new(\$opt) );
}
elsif ( \$opt->{associative} ) {
if ( \$opt->{method_key} ) {
require PerlBean::Attribute::Multi::Unique::Associative::MethodKey;
return( PerlBean::Attribute::Multi::Unique::Associative::MethodKey->new(\$opt) );
}
else {
require PerlBean::Attribute::Multi::Unique::Associative;
return( PerlBean::Attribute::Multi::Unique::Associative->new(\$opt) );
}
}
else {
require PerlBean::Attribute::Multi::Unique;
return( PerlBean::Attribute::Multi::Unique->new(\$opt) );
}
}
else {
require PerlBean::Attribute::Multi::Ordered;
return( PerlBean::Attribute::Multi::Ordered->new(\$opt) );
}
}
else {
throw Error::Simple("ERROR: PerlBean::Attribute::Factory::attribute, option 'type' must be one of 'BOOLEAN', 'SINGLE' or 'MULTI' and NOT '\$opt->{type}'.");
}
EOF
},
],
} );
sub get_syn { use IO::File; my $fh = IO::File->new('< syn-PerlBean_Attribute_Factory.pl'); $fh = IO::File->new('< gen/syn-PerlBean_Attribute_Factory.pl') if (! defined($fh)); my $syn = ''; my $prev_line = $fh->getline (); while (my $line = $fh->getline ()) { $syn .= ' ' . $prev_line; $prev_line = $line; } return($syn); }
1;
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 107:
=back doesn't take any parameters, but you said =back EOF body => <<EOF, my \$self = shift; my \$opt = shift || {};