adding some methods to role, other small cleanups

This commit is contained in:
Graham Knop 2009-12-07 12:16:07 -06:00
parent c7995b716e
commit bb2667206d
2 changed files with 14 additions and 5 deletions

View file

@ -130,9 +130,7 @@ regular attributes.
sub property {
my ($meta, $name, %options) = @_;
my %form_options;
my $prop_meta =
$meta->property_meta;
#'WebGUI::Definition::Meta::Property';
my $prop_meta = $meta->property_meta;
for my $key ( keys %options ) {
if ( ! $prop_meta->meta->find_attribute_by_name($key) ) {
$form_options{$key} = delete $options{$key};

View file

@ -36,7 +36,7 @@ sub get {
sub set {
my $self = shift;
my $properties = shift;
my $properties = @_ % 2 ? shift : { @_ };
for my $key ( keys %$properties ) {
return undef
unless $self->can($key);
@ -46,11 +46,22 @@ sub set {
}
sub update {
my $self;
my $self = shift;
$self->set(@_);
if ($self->can('write')) {
$self->write;
}
return 1;
}
sub getProperty {
my $self = shift;
return $self->meta->find_attribute_by_name(@_);
}
sub getProperties {
my $self = shift;
return $self->meta->get_all_properties;
}
1;