Thread Thread zum Freuen (190 answers)
Opened by pq at 2012-02-06 21:03

rosti
 2013-07-06 11:38
#168752 #168752
User since
2011-03-19
3180 Artikel
BenutzerIn
[Homepage]
user image
Geiles Modul, freu ;)

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
my $t = tie my %cfg, 'DBFreezer', %cred or die $@;
$cfg{addr} = {
        name => 'Boo',
        prop => 'dog',
        misc => {
                weiteres => {
                        foo => 'bar',
                        date => strftime('%d.%m.%Y %X', localtime),
                }
        },
        env => 'Hier kann die Umgebung stehen...',
};
$cfg{'perl -v'} = join('',qx(perl -v));
$t->write or die $@;

print Dumper \%cfg;


Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
$VAR1 = {
          'perl -v' => '
This is perl, v5.8.8 built for i686-linux

Copyright 1987-2006, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

',
          'addr' => {
                      'prop' => 'dog',
                      'env' => 'Hier kann die Umgebung stehen...',
                      'misc' => {
                                  'weiteres' => {
                                                  'date' => '06.07.2013 11:34:25',
                                                  'foo' => 'bar'
                                                }
                                },
                      'name' => 'Boo'
                    }
        };


Useful to store complex data structures. Useful for storing multiple hashes by entity. Mehrzeilige Variablen, UTF-8... echt der Hammer das Teil.

--rosti
Last edited: 2013-07-06 11:39:45 +0200 (CEST)

View full thread Thread zum Freuen