aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/WebCoso/Resource.pm48
1 files changed, 48 insertions, 0 deletions
diff --git a/lib/WebCoso/Resource.pm b/lib/WebCoso/Resource.pm
index 39179fe..27bad65 100644
--- a/lib/WebCoso/Resource.pm
+++ b/lib/WebCoso/Resource.pm
@@ -6,6 +6,7 @@ use Class::Std;
{
my %values_of :ATTR(:default<{}>);
+my %propnames_of :ATTR(:default<{}>);
my %axes_of :ATTR(:default<{}>);
sub get_axes {
@@ -14,6 +15,53 @@ sub get_axes {
return keys %{$axes_of{ident $self}};
}
+sub get_axis_values {
+ my ($self,$axis_name)=@_;
+
+ return keys %{$axes_of{ident $self}->{$axis_name}};
+}
+
+sub set_property {
+ my $self=shift;
+ my $axes_spec= (ref($_[0]) eq 'HASH') ? (shift) : {};
+ my ($prop_name,$prop_value)=@_;
+
+ $self->_populate_axes_from($axes_spec);
+ my $key=_genkey($axes_spec);
+
+ $propnames_of{ident $self}->{$prop_name}=undef;
+
+ $values_of{ident $self}->{$prop_name}->{$key}=$prop_value;
+
+ return;
+}
+
+sub get_property {
+ my $self=shift;
+ my $axes_spec= (ref($_[0]) eq 'HASH') ? (shift) : {};
+ my ($prop_name)=@_;
+
+ my $key=_genkey($axes_spec);
+
+ return $values_of{ident $self}->{$prop_name}->{$key};
+}
+
+sub _populate_axes_from {
+ my ($self,$axes_spec)=@_;
+
+ while (my ($axis_name,$axis_value)=each %$axes_spec) {
+ my $axis_value_set=($axes_of{ident $self}->{$axis_name} ||= {});
+ $axis_value_set->{$axis_value}=undef;
+ }
+
+ return;
+}
+
+sub _genkey {
+ my ($axes_spec)=@_;
+
+ return '1';
+}
}