diff options
author | dakkar <dakkar@luxion> | 2005-11-05 10:57:58 +0000 |
---|---|---|
committer | dakkar <dakkar@luxion> | 2005-11-05 10:57:58 +0000 |
commit | c8e73a5e1f75b6f6ceff09e088c0f69861b6c448 (patch) | |
tree | e050275e3ad19c0c306a3072c1212b5627222eaf /lib/WebCoso/Config/Collection.pm | |
parent | creato contenitore collezioni, migliorata gestione lingue (diff) | |
download | WebCoso-c8e73a5e1f75b6f6ceff09e088c0f69861b6c448.tar.gz WebCoso-c8e73a5e1f75b6f6ceff09e088c0f69861b6c448.tar.bz2 WebCoso-c8e73a5e1f75b6f6ceff09e088c0f69861b6c448.zip |
spostata eccezione di file not found, cambiati i 'die' con Exception::Class, inizio di aggancio c-r
git-svn-id: svn://luxion/repos/WebCoso/trunk@19 fcb26f47-9200-0410-b104-b98ab5b095f3
Diffstat (limited to 'lib/WebCoso/Config/Collection.pm')
-rw-r--r-- | lib/WebCoso/Config/Collection.pm | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/WebCoso/Config/Collection.pm b/lib/WebCoso/Config/Collection.pm index c4b6347..6108623 100644 --- a/lib/WebCoso/Config/Collection.pm +++ b/lib/WebCoso/Config/Collection.pm @@ -28,7 +28,11 @@ sub BUILD { $children_of{$ident}=$children; $_->add_parent($self) for @$children; + $resources_of{$ident}=[]; + WebCoso::Config->add_collection($self); + + return; } sub axes { @@ -74,6 +78,8 @@ sub add_child { push @{ $self->get_children_ref() },$child; $child->add_parent($self); + + return; } sub add_parent { my ($self,$parent)=@_; @@ -85,6 +91,28 @@ sub add_parent { push @{ $self->get_parents_ref() },$weak_parent; $parent->add_child($self); + + return; +} +sub add_res { + my ($self, @resources)=@_; + + # creo una tabellina di look-up per evitare i duplicati + # NOTA: le chiavi sono stringhe, non ref, non si può usare per + # pescare gli oggetti + my %res_key; + @res_key{ @{ $self->get_resources_ref() } } = (); + + RESOURCES: + for my $res (@resources) { + next RESOURCES if exists $res_key{$res}; + + push @{ $self->get_resources_ref() }, $res; + $res_key{$res}=undef; + $res->add_coll($self); + } + + return; } sub get_parents { |