Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
Tangram::Type::Dump::PUser3Contributed Perl DocumeTangram::Type::Dump::Perl(3)

       Tangram::Type::Dump::Perl - map any Perl	object as scalar dump

	  use Tangram::Core;
	  use Tangram::Type::Dump::Perl; # always

	  $schema = Tangram::Schema->new(
	     classes =>	{ NaturalPerson	=> { fields => {

	     perl_dump =>
		diary => # diary is a perl hash
		   col => 'diarydata',
		   sql => 'TEXT',
		   indent => 0,
		   terse => 1,
		   purity => 0

		lucky_numbers => 'int',	# use defaults

       Maps arbitrary Perl data	structures by serializing to a string
       representation. The persistent fields are grouped in a hash under the
       "perl_dump" key in the field hash.

       Serialization is	done by	Data::Dumper, which traverses the Perl data
       structure and creates a string representation of	it. The	resulting
       string will be mapped to	the DBMS as a scalar value. During restore,
       the scalar value	will be	eval'd to reconstruct the original data

       As of Tangram 2.07.1, persistent	references are safely handled via the
       Tangram::Type::Dump utility class.

       The field names are passed in a hash that associates a field name with
       a field descriptor. The field descriptor	may be either a	hash or	a
       string. The hash	uses the following fields:

       o   col

       o   sql

       o   indent

       o   terse

       o   purity

       The optional fields "col" and "sql" specify the column name and the
       column type for the scalar value	in the database. If not	present, "col"
       defaults	to the field name and "sql" defaults to	VARCHAR(255).  Values
       will be always quoted as	they are passed	to the database.

       The remaining optional fields control the serialization process.	They
       will be passed down to Data::Dumper as values to	the corresponding
       Data::Dumper options. The default settings are: no indentation
       ("indent=0"), compact format ("terse=1"), and quick dump	("purity=0").

       This mapping was	contributed by Gabor Herr

perl v5.32.0			  2015-10-09	  Tangram::Type::Dump::Perl(3)


Want to link to this manual page? Use this URL:

home | help