/[cvs]/nfo/perl/libs/Data/Mungle/Transform/Encode.pm
ViewVC logotype

Diff of /nfo/perl/libs/Data/Mungle/Transform/Encode.pm

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

revision 1.3 by joko, Thu Feb 20 20:48:36 2003 UTC revision 1.5 by joko, Wed Apr 9 07:22:34 2003 UTC
# Line 2  Line 2 
2  ##  $Id$  ##  $Id$
3  ## -------------------------------------------------------------------------  ## -------------------------------------------------------------------------
4  ##  $Log$  ##  $Log$
5    ##  Revision 1.5  2003/04/09 07:22:34  joko
6    ##  childObj2string now inside Encode.pm, renamed to 'twingle_reference'
7    ##
8    ##  Revision 1.4  2003/03/27 15:17:07  joko
9    ##  namespace fixes for Data::Mungle::*
10    ##
11  ##  Revision 1.3  2003/02/20 20:48:36  joko  ##  Revision 1.3  2003/02/20 20:48:36  joko
12  ##  renamed methods  ##  renamed methods
13  ##  ##
# Line 17  Line 23 
23  ## -------------------------------------------------------------------------  ## -------------------------------------------------------------------------
24    
25    
26  package Data::Transform::Encode;  package Data::Mungle::Transform::Encode;
27    
28  use strict;  use strict;
29  use warnings;  use warnings;
30    
31  require Exporter;  require Exporter;
32  our @ISA = qw( Exporter );  our @ISA = qw( Exporter );
33  our @EXPORT_OK = qw( &latin_to_utf8 &latin_to_utf8_scalar &utf8_to_latin &utf8_to_latin_scalar );  our @EXPORT_OK = qw(
34      &latin_to_utf8
35      &latin_to_utf8_scalar
36      &utf8_to_latin
37      &utf8_to_latin_scalar
38      &twingle_reference
39    );
40    
41    
42  use Unicode::String qw(utf8 latin1);  use Unicode::String qw(utf8 latin1);
# Line 91  sub utf8_to_latin_scalar { Line 103  sub utf8_to_latin_scalar {
103    }    }
104  }  }
105    
106    
107    # encodes object-references to serialized string representations
108    # made up of:
109    #   - 'o_<classname>_<ref type>_<guid>'???
110    #   - 'o_{guid}_{classname}'!!!
111    
112    # TODO: enhance further!
113    # make it possible to twingle OID-, GUID- and/or other references
114    
115    sub twingle_reference {
116      my $obj = shift;
117      my $option = shift;
118      my $string = 'n/a';
119      
120      #if ($option == 1) {
121        if ((my $classname = ref $obj) && (my $guid = $obj->{guid})) {
122          $string = join('_', 'o', $guid, $classname);
123        }  
124      #}
125      
126      return $string;
127    }
128    
129    
130  1;  1;
131  __END__  __END__

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.5

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