/[cvs]/nfo/perl/libs/Tangram/AbstractHash.pm
ViewVC logotype

Contents of /nfo/perl/libs/Tangram/AbstractHash.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Mon Nov 25 00:05:48 2002 UTC (21 years, 7 months ago) by joko
Branch: MAIN
+ original version from Tangram 2.04

1 # (c) Sound Object Logic 2000-2001
2
3 use strict;
4
5 package Tangram::AbstractHash;
6
7 use Tangram::Coll;
8 use base qw( Tangram::Coll );
9
10 use Carp;
11
12 sub content
13 {
14 shift;
15 @{shift()};
16 }
17
18 sub demand
19 {
20 my ($self, $def, $storage, $obj, $member, $class) = @_;
21
22 print $Tangram::TRACE "loading $member\n" if $Tangram::TRACE;
23
24 my %coll;
25
26 if (my $prefetch = $storage->{PREFETCH}{$class}{$member}{$storage->id($obj)})
27 {
28 %coll = %$prefetch;
29 }
30 else
31 {
32 my $cursor = $self->cursor($def, $storage, $obj, $member);
33
34 for (my $item = $cursor->select; $item; $item = $cursor->next)
35 {
36 my $slot = shift @{ $cursor->{-residue} };
37 $coll{$slot} = $item;
38 }
39 }
40
41 $storage->{scratch}{ref($self)}{$storage->id($obj)}{$member} = {
42 map { $_ => ($coll{$_} && $storage->id( $coll{$_} ) ) } keys %coll };
43
44 return \%coll;
45 }
46
47 1;

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed