/[cvs]/nfo/perl/libs/Data/Storage/Handler/Tangram.pm
ViewVC logotype

Diff of /nfo/perl/libs/Data/Storage/Handler/Tangram.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.14 by jonen, Thu Dec 5 09:40:30 2002 UTC revision 1.15 by joko, Thu Dec 5 13:55:21 2002 UTC
# Line 3  Line 3 
3  #  $Id$  #  $Id$
4  #  #
5  #  $Log$  #  $Log$
6    #  Revision 1.15  2002/12/05 13:55:21  joko
7    #  + now utilizing 'object2hash' instead of 'var_deref'
8    #  + played around with having fresh-objects - no progress....
9    #
10  #  Revision 1.14  2002/12/05 09:40:30  jonen  #  Revision 1.14  2002/12/05 09:40:30  jonen
11  #  + added option->{destroy} at getObject for unloading all instance  #  + added option->{destroy} at getObject for unloading all instance
12  #  #
# Line 78  use Data::Dumper; Line 82  use Data::Dumper;
82  use libp qw( getNewPerlObjectByPkgName );  use libp qw( getNewPerlObjectByPkgName );
83  use Data::Storage::Result::Tangram;  use Data::Storage::Result::Tangram;
84  use Data::Compare::Struct qw( isEmpty );  use Data::Compare::Struct qw( isEmpty );
85  use Data::Transform::Deep qw( var_deref );  use Data::Transform::Deep qw( object2hash );
86  use Data::Transform::Encode qw( var2utf8 );  use Data::Transform::Encode qw( var2utf8 );
87    
88    
# Line 506  sub getObjectAsHash { Line 510  sub getObjectAsHash {
510    my $oid = shift;    my $oid = shift;
511    my $options = shift;    my $options = shift;
512    my $obj = $self->getObject($oid, $options);    my $obj = $self->getObject($oid, $options);
513    my $deref = var_deref($obj);    
514    var2utf8($deref) if ($options->{utf8});    # build options (a callback to unload autovivified objects) for 'expand'
515    #$obj->clear_refs;    # TODO: use $logger to write to debug here!
516    #$self->{COREHANDLE}->unload($obj) if($options->{destroy});    my $cb; # = sub {};
517    #$obj->DESTROY;  =pod
518    #undef($obj) if($options->{destroy});    if ($options->{destroy}) {
519    return $deref;      $options->{cb}->{destroy} = sub {
520          print "================ DESTROY", "\n";
521          my $object = shift;
522          #print Dumper($object);
523          $self->{_COREHANDLE}->unload($object);
524          #undef($object);
525        };
526      }
527    =cut
528    
529      my $hash = object2hash($obj, $options);
530      #$options->{cb}->{destroy}->($obj);
531      #$self->{_COREHANDLE}->unload($obj);
532      
533      # convert values in hash to utf8 to be ready for (e.g.) encapsulation in XML
534      # now done in object2hash
535      #var2utf8($hash) if ($options->{utf8});
536      
537      # old (wrong) attempts to get rid of used instances, if requested
538        #$obj->clear_refs;
539        #$self->{COREHANDLE}->unload($obj) if($options->{destroy});
540        #$obj->DESTROY;
541        #undef($obj) if($options->{destroy});
542      
543      return $hash;
544  }  }
545    
546  sub getSchema {  sub getSchema {

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

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