NAME
Data::Record::Serialize::Role::Base - Base Role for Data::Record::Serialize
VERSION
version 1.06
DESCRIPTION
Data::Record::Serialize::Role::Base
is the base role for Data::Record::Serialize. It serves the place of a base class, except as a role there is no overhead during method lookup
OBJECT ATTRIBUTES
types
If no types are available, returns undef
; see also "has_types".
Otherwise, returns a hashref whose keys are the input field names and whose values are the types (N
, I
, S
, B
). If types are deduced from the data, this mapping is finalized (and thus accurate) only after the first record has been sent.
default_type
type
The value passed to the constructor (if any).
fields
The names of the input fields that will be output.
nullify
The value passed to the constructor (if any).
numify
$bool = $s->numify;
The value passed to the constructor (if any). See the discussion for the numify constructor option.
stringify
$bool = $s->stringify;
The value passed to the constructor (if any). See the discussion for the stringify constructor option.
format_fields
The value passed to the constructor (if any).
format_types
The value passed to the constructor (if any).
rename_fields
The value passed to the constructor (if any).
format
If true, format the output fields using the formats specified in the format_fields
and/or format_types
options. The default is false.
METHODS
has_types
returns true if "types" has been set.
has_default_type
returns true if "default_type" has been set.
has_fields
returns true if "fields" has been set.
output_fields
$array_ref = $s->output_fields;
The names of the output fields, in order of requested output. This takes into account fields which have been renamed.
has_nullify
returns true if "nullify" has been set.
has_numify
returns true if "numify" has been set.
has_stringify
returns true if "stringify" has been set.
nullified
$fields = $obj->nullified;
Returns a arrayref of fields which are checked for empty values (see "nullify").
This will return an empty array if the list is not yet available (for example, if fields names are determined from the first output record and none has been sent).
If the list of fields is available, calling nullified may result in verification of the list of nullified fields against the list of actual fields. A disparity will result in an exception of class Data::Record::Serialize::Error::Role::Base::fields
.
numified
$fields = $obj->numified;
Returns an arrayref of fields which are converted to numbers.
This will return an empty array if the list is not yet available (for example, if fields names are determined from the first output record and none has been sent).
If the list of fields is available, calling numified may result in verification of the list of numified fields against the list of actual fields. A disparity will result in an exception of class Data::Record::Serialize::Error::Role::Base::fields
.
stringified
$fields = $obj->stringified;
Returns an arrayref of fields which are converted to strings.
This will return an empty array if the list is not yet available (for example, if fields names are determined from the first output record and none has been sent).
If the list of fields is available, calling stringified may result in verification of the list of stringified fields against the list of actual fields. A disparity will result in an exception of class Data::Record::Serialize::Error::Role::Base::fields
.
string_fields
$array_ref = $s->string_fields;
The input field names for those fields deemed to be strings
numeric_fields
$array_ref = $s->numeric_fields;
The input field names for those fields deemed to be numeric (either N or I).
boolean_fields
$array_ref = $s->boolean_fields;
The input field names for those fields deemed to be boolean.
type_index
$arrayref = $s->type_index;
An array, with indices representing field type or category. The values are an array of field names. This is finalized (and thus accurate) only after the first record is written.
Don't edit this!.
The indices are available via Data::Record::Serialize::Util and are:
- INTEGER
- FLOAT
- NUMBER
-
FLOAT
andINTEGER
- STRING
- NOT_STRING
-
everything that's not
STRING
- BOOLEAN
output_types
$hash_ref = $s->output_types;
The fully resolved mapping between output field name and output field type. If the encoder has specified a type map, the output types are the result of that mapping. This is only valid after the first record has been sent.
INTERNALS
SUPPORT
Bugs
Please report any bugs or feature requests to bug-data-record-serialize@rt.cpan.org or through the web interface at: https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Record-Serialize
Source
Source is available at
https://gitlab.com/djerius/data-record-serialize
and may be cloned from
https://gitlab.com/djerius/data-record-serialize.git
SEE ALSO
Please see those modules/websites for more information related to this module.
AUTHOR
Diab Jerius <djerius@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2017 by Smithsonian Astrophysical Observatory.
This is free software, licensed under:
The GNU General Public License, Version 3, June 2007