adding some methods to role, other small cleanups
This commit is contained in:
parent
c7995b716e
commit
bb2667206d
2 changed files with 14 additions and 5 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue