GetData(3pm)

πŸ’– NAME πŸ’–

okay so, bestie, welcome to GetData(3pm) β€” the manual page for GetData, aka the Perl bindings to the GetData library for Dirfile access. that's it, that's the name, slay. πŸ’…


✨ SYNOPSIS ✨

lowkey the whole vibe in five lines:

use GetData;

my $DIRFILE = GetData::open("./dirfile/", $GetData::RDONLY);

# the following calls are equivalent
my $data = GetData::getdata($DIRFILE, "field", 5, 0, 1,
                            $GetData::UINT8);
my $data = $DIRFILE->getdata("field", 5, 0, 1, $GetData::UINT8);

two ways to call the same thing, both iconic, no notes. 🫢


🌸 DESCRIPTION 🌸

so this module is the simple, lightweight bridge between Perl and the C GetData library. it's giving "no drama, just a clean mapping between public C functions and Perl methods." every single C function and constant gets replicated inside the GetData package, and the methods keep the exact same name as their C counterparts β€” except the C namespace prefix gd_ gets dropped (and GD_ too, for the C preprocessor constants). periodt.

the dirfile lvalue that GetData::open hands you back is a simplistic object. here's the cute part: any GetData method that takes a dirfile as a parameter can also just be called as a method of the dirfile object itself. (peep the synopsis above for the receipts. ✨) and dirfile metadata entries β€” which in C are structs of type gd_entry_t β€” are represented here as plain old simple hashes. easy.

by default, GetData exports nothing. zero symbols. if you want them all, you do:

use GetData "all";

but ngl this is discouraged, because it will clobber useful things like &CORE::open. do not do that to yourself bestie, that's not the move. 😭

throughout the module, complex data are generally represented as Math::Complex objects β€” but they may get simplified down to ordinary floating point numbers whenever the imaginary part is zero. no imaginary friends, no problem.


πŸ‘‘ CONSTANTS πŸ‘‘

the module defines a large number of symbolic constants used by the API, and they mirror the constants defined in the C API one-to-one. if you only want the constants, the "constants" tag exports just those:

use GetData "constants";

some generally useful sets of constants get discussed below, and the rest show up in the method descriptions wherever they're used. πŸŽ€

πŸ’– Data Types πŸ’–

GetData knows the following data types:

  • $GetData::NULL β€” the null data type, which returns no data.
  • $GetData::UINT8 β€” unsigned 8-bit integer.
  • $GetData::INT8 β€” signed (two's complement) 8-bit integer.
  • $GetData::UINT16 β€” unsigned 16-bit integer.
  • $GetData::INT16 β€” signed (two's complement) 16-bit integer.
  • $GetData::UINT32 β€” unsigned 32-bit integer.
  • $GetData::INT32 β€” signed (two's complement) 32-bit integer.
  • $GetData::UINT64 β€” unsigned 64-bit integer.
  • $GetData::INT64 β€” signed (two's complement) 64-bit integer.
  • $GetData::FLOAT32 β€” IEEE-754 standard 32-bit single precision floating point number.
  • $GetData::FLOAT64 β€” IEEE-754 standard 64-bit double precision floating point number.
  • $GetData::COMPLEX64 β€” FORTRAN and C99 conformant 64-bit single precision floating point complex number.
  • $GetData::COMPLEX128 β€” FORTRAN and C99 conformant 128-bit double precision floating point complex number.

🌈 Encoding Types 🌈

the following encoding types are known by GetData:

$GetData::BZIP2_ENCODED, $GetData::FLAC_ENCODED,
$GetData::GZIP_ENCODED, $GetData::LZMA_ENCODED,
$GetData::SIE_ENCODED, $GetData::SLIM_ENCODED,
$GetData::TEXT_ENCODED, $GetData::ZZIP_ENCODED,
$GetData::ZZSLIM_ENCODED, $GetData::UNENCODED.

the deets on these encoding types live in the dirfile-format(5) manual page β€” go look, iykyk. πŸ¦‹

🧚 Entry Types 🧚

these symbols are what you use to indicate entry types:

$GetData::NO_ENTRY, $GetData::BIT_ENTRY, $GetData::CARRAY_ENTRY,
$GetData::CONST_ENTRY, $GetData::DIVIDE_ENTRY,
$GetData::INDEX_ENTRY, $GetData::LINCOM_ENTRY,
$GetData::LINTERP_ENTRY, $GetData::MPLEX_ENTRY,
$GetData::MULTIPLY_ENTRY, $GetData::PHASE_ENTRY,
$GetData::POLYNOM_ENTRY, $GetData::RAW_ENTRY, $GetData::RECIP_ENTRY,
$GetData::SBIT_ENTRY, $GetData::STRING_ENTRY, $GetData::WINDOW_ENTRY

out of all of these, $GetData::NO_ENTRY is the one that flags invalid entry types, and $GetData::INDEX_ENTRY is used only for the implicit INDEX field. for the rest? check gd_entry(3) and dirfile-format(5). πŸ“š

⭐ WINDOW Operators ⭐

these symbols are used to indicate WINDOW operators:

$GetData::WINDOP_EQ, $GetData::WINDOP_GE, $GetData::WINDOP_GT,
$GetData::WINDOP_LE, $GetData::WINDOP_LT, $GetData::WINDOP_NE,
$GetData::WINDOP_CLR, $GetData::WINDOP_SET.

πŸ“ INPUT DATA πŸ“

so the functions that take sets of data as input β€” that's add_carray, madd_carray, put_carray, put_carray_slice, and putdata β€” accept that data in a whole bunch of different ways. the arguments that specify the data always show up at the very end of the argument list, and below they're written as {DATA...} in the method descriptions. here's exactly how input data arguments get parsed, in order:

  1. if the first data argument is undef, it gets ignored and all the subsequent arguments are taken as data:
$dirfile->putdata("field_code", $first_frame, $first_sample,
                  undef, @data)

or:

$dirfile->putdata("field_code", $first_frame, $first_sample,
                  undef, $data[0], $data[1], $data[2], ...)
  1. otherwise, if the first data argument is a reference to an array, then the array is taken as the data β€” and any further arguments are just ignored:
$dirfile->putdata("field_code", $first_frame, $first_sample,
                  \@data)
  1. otherwise, if only two arguments make up the data argument list and the second one is a reference to an array, then the first is taken as a type code specifying the conversion type, and the second is taken as the data:
$dirfile->putdata("field_code", $first_frame, $first_sample,
                  $GetData::UINT8, \@data)
  1. otherwise, if only two arguments make up the data argument list and the second one is not a reference to an array, then the first is, again, taken as a type code, and the second is assumed to be a packed string holding the data in whatever format is appropriate for the type code you specified:
$packed_data = pack("C", @data)
$dirfile->putdata("field_code", $first_frame, $first_sample,
                  $GetData::UINT8, $packed_data)
  1. otherwise, finally, the elements of the data argument list are simply taken as data themselves:
$dirfile->putdata("field_code", $first_frame, $first_sample,
                  @data)

or:

$dirfile->putdata("field_code", $first_frame, $first_sample,
                  $data[0], $data[1], $data[2], ...)

GetData internally converts your Perl data into a format the C API can read. in cases 3 and 4 above, the type it converts into is stated explicitly right there in the call, no guessing. in the other cases, GetData has to guess an appropriate C type to convert into β€” and it does that by looking at the first data value:

  • if the value is a Math::Complex object, the data get converted to double precision complex data (COMPLEX128)
  • if the value is an integer, the data get converted to a 64-bit signed integer (INT64)
  • otherwise, the data get converted to a double precision float (FLOAT64)

and of all the methods above, the first one is only necessary when your data array has exactly two elements β€” because otherwise it would get mistaken for method four if you didn't put that initial undef in front. also, the fourth method is typically the most efficient of the bunch, since the packed data scalar can often be fed straight into the C API with no type conversion needed at all. efficiency, we love her. πŸ’…


πŸŽ€ ENTRY HASHES πŸŽ€

the replacement for the C API's gd_entry_t object is a simple hash, and the key names are the same as the names of the gd_entry_t members. (details live in gd_entry(3), go read it bestie.)

in the entry hashes that GetData returns, only the keys appropriate for the entry type you specified will actually be present. but entry hashes you pass into GetData from your own code may have other keys than the entry type requires β€” and those just get ignored. no harm, no foul. πŸ™ˆ

the value hanging off the field_type key will be one of the symbols listed under "Entry Types" above. and for the entry types that have (potentially) more than one input field β€” that's DIVIDE, LINCOM, MPLEX, MULTIPLY, WINDOW β€” the value associated with the in_fields key will be a list of strings, no matter how many elements it actually has. other entry types that provide in_fields get a scalar instead, even though the key name stays plural. grammar is fake, the key name is forever. ✨

elements of the scalar array that are undef indicate literal parameters β€” the equivalent of NULL in the gd_entry_t's scalar member. and similarly, undef is used in scalar_ind wherever the C API uses -1, to indicate CONST fields instead of CARRAYs. πŸ“


πŸ’œ NON-MEMBER FUNCTIONS πŸ’œ

  • encoding_support ($ENCODING) β€” returns $GetData::RDWR if the library can both read and write the specified encoding, $GetData::RDONLY if it can only read it, or -1 otherwise. $ENCODING should be one of the encoding symbols listed up above in the "Encoding Types" section. πŸ¦‹

✨ DIRFILE CREATION METHODS ✨

Okay bestie, this is where you actually make a dirfile or open one up. Two functions here, and they're giving main character energy. 🫢

  • open ($DIRFILENAME, $FLAGS, $SEHANDLER=undef, $EXTRA=undef) β€” Creates or opens a Dirfile database called $DIRFILENAME. The $FLAGS should be either $GetData::RDONLY (read-only access, cute and safe) or $GetData::RDWR (read-write access, chaotic if you're not careful), optionally bitwise or'd with any of these flags:
$GetData::ARM_ENDIAN, $GetData::BIG_ENDIAN, $GetData::CREAT,
$GetData::EXCL, $GetData::FORCE_ENCODING,
$GetData::FORCE_ENDIAN, $GetData::IGNORE_DUPS,
$GetData::IGNORE_REFS, $GetData::LITTLE_ENDIAN,
$GetData::NOT_ARM_ENDIAN, $GetData::PEDANTIC,
$GetData::PERMISSIVE, $GetData::PRETTY_PRINT, $GetData::TRUNC,
$GetData::TRUNCSUB, $GetData::VERBOSE,

and at most one of the encoding symbols listed above in the "Encoding Types" section, or else $GetData::AUTO_ENCODED β€” that one tells GetData to try to automatically determine the encoding. The meaning of the dirfile flags may be found in the gd_cbopen(3) manual page. πŸ“–

$SEHANDLER is a Perl callback function that gets executed whenever a syntax error is encountered. It may be undef if you don't want a callback. When called, $SEHANDLER gets two arguments: first, a reference to a hash containing the parser data; second, the $EXTRA scalar passed to this method. $SEHANDLER is called in scalar context, and it should return either:

  • an integer, one of these symbolic constants:
$GetData::SYNTAX_ABORT, $GetData::SYNTAX_CONTINUE,
$GetData::SYNTAX_IGNORE, $GetData::SYNTAX_RESCAN;

(see gd_cbopen(3) for their meaning), or

  • a string containing the corrected line, in which case $GetData::SYNTAX_RESCAN is assumed; or,
  • a reference to a list consisting of an integer, one of the "$GetData::SYNTAX_..." constants listed above, and then, optionally, a string containing the corrected line.

This function always returns a Dirfile object, even if the call failed. So the caller should use the returned dirfile's error() method to test for success. On error, the returned object will be flagged as invalid. πŸ’€

  • invalid_dirfile () β€” This function always returns a newly created, but invalid, Dirfile object. Unlike an invalid dirfile created (either accidentally or purposefully) using open(), the dirfile returned by this function always has a zero error code. See gd_invalid_dirfile(3). ✨

πŸ’– DIRFILE OBJECT METHODS πŸ’–

The following methods all operate on a dirfile object returned by one of the above methods and can either be called as:

$GetData::method($dirfile, ...)

or else, as:

$dirfile->method(...)

without change in operation. No cap. πŸ‘‘

πŸ“‹ List of Methods πŸ“‹

  • $dirfile->add_carray ($FIELD_NAME, $DATA_TYPE, $FRAGMENT_INDEX, {DATA...}) β€” Adds a new CARRAY field called $FIELD_NAME to the metadata fragment indexed by $FRAGMENT_INDEX. The storage type of the CARRAY is given by $DATA_TYPE, which should be one of the symbols listed above under "Data Types". The value of the CARRAY is then set to the data given in the "{DATA...}" argument list, which also determines its length. See the "Input Data" section above for details on the allowed forms of "{DATA...}". See gd_add_carray(3). 🧚
  • $dirfile->add_const ($FIELD_NAME, $DATA_TYPE, [$VALUE, $FRAGMENT_INDEX]) β€” Adds a new CONST field called $FIELD_NAME to the metadata fragment indexed by $FRAGMENT_INDEX, or to the primary format file if omitted. The $DATA_TYPE argument indicates the storage type, which should be one of the symbols listed above under "Data Types". If given, the value of the field is set to $VALUE; otherwise the field will be initialised to zero. See gd_add_const(3). πŸ’–
  • $dirfile->aliases ($FIELD_CODE) β€” In scalar context, returns the number of aliases of $FIELD_CODE. In list context, returns an array of alias names for $FIELD_CODE. See gd_naliases(3) and gd_aliases(3). 🌸
  • $dirfile->carrays ($RETURN_TYPE) β€” Returns the value of all carrays (excluding metafields) in the dirfile after converting them to the return type $RETURN_TYPE, which should be one of the symbols listed under "Data Types" above. If called in scalar context, returns a reference to an array of packed string data. If called in list context, returns an array of arrays of unpacked data. See gd_carrays(3). πŸŽ€
  • $dirfile->close () β€” Closes the dirfile, writing changes to disk. Upon successful completion, the dirfile object will be invalidated, prohibiting further operation on it. A dirfile which is destroyed by garbage collection is discarded (see "discard" below). This function should be called if metadata need to be written to disk before the object goes out of scope. See gd_close(3). πŸ”₯
  • $dirfile->constants ($RETURN_TYPE) β€” Returns the value of all constants (excluding metafields) in the dirfile after converting them to the return type $RETURN_TYPE, which should be one of the symbols listed under "Data Types" above. If called in scalar context, returns a packed string containing the data. If called in list context, the data will be unpacked and returned as an array. See gd_constants(3). ⭐
  • $dirfile->discard () β€” Closes the dirfile, ignoring changes to metadata, but writing changed data to disk. Upon successful completion, the dirfile object will be invalidated, prohibiting further operation on it. This function is called automatically by the dirfile destructor, and need not be called explicitly. To save the metadata on close, use "close". See gd_discard(3). πŸ—‘οΈ
  • $dirfile->entry ($FIELD_CODE) β€” If called in scalar context, returns the entry type of $FIELD_CODE, one of the symbols listed above under "Entry Types". In array context, returns a hash describing the indicated field. See gd_entry_type(3) and gd_entry(3). πŸ”
  • $dirfile->match_entries ($REGEX, $FRAGMENT, $TYPE, $FLAGS) β€” In scalar context, returns the number of entries matching the supplied criteria. In list context, returns an array of the names of the entries. If $REGEX is not undef, it is a regular expression which is matched against entry names.
NB: The regular expression handling is done in the underlying C library, not in Perl. As a result, using Perl's regex grammar in $REGEX usually won't work as desired. If the C GetData library has Perl-Compatible Regular Expression (PCRE) support, the $GetData::REGEX_PCRE flag can be used to select a regular expression grammar which is very similar to Perl's own. 😭

If $FRAGMENT is not $GetData::ALL_FRAGMENTS or undef, only entries defined in the specified fragment are searched. If $TYPE is one of the entry types listed above under "Entry Types", only entries of that type are considered. Alternatley, $TYPE may be one of:

$GetData::ALL_ENTRIES, $GetData::SCALAR_ENTRIES,
$GetData::VECTOR_ENTRIES.

Setting $TYPE to undef is equivalent to setting it to $GetData::ALL_ENTRIES. If not undef, which is treated as zero, $FLAGS should be zero or more of the following flags:

$GetData::ENTRIES_HIDDEN, $GetData::ENTRIES_NOALIAS,
$GetData::REGEX_PCRE, $GetData::REGEX_EXTENDED,
$GetData::REGEX_ICASE, $GetData::REGEX_CASELESS,
$GetData::REGEX_JAVASCRIPT, $GetData::REGEX_UNICODE

See gd_match_entries(3) for the meaning of these symbols. 🌈

  • $dirfile->entry_list ($PARENT, $TYPE, $FLAGS) β€” In scalar context, returns the number of entries matching the supplied criteria. In list context, returns an array of the names of the entries. If $PARENT is undef, top-level entries are considered; otherwise meta entries under $PARENT are considered. For $TYPE and $FLAGS, see "$dirfile-"match_entries> above (the regex flags listed there are ignored by this function), and also gd_nentries(3) and gd_entry_list(3). 🫢
  • $dirfile->error () β€” Returns the error code of the last operation on this dirfile. See gd_error(3). πŸ’€
  • $dirfile->error_string () β€” Returns a string describing the error encountered (if any) by the last operation on this dirfile. See gd_error_string(3). 😭
  • $dirfile->field_list () β€” Equivalent to: "$dirfile->entry_list(undef, undef, undef)". πŸ“‹
  • $dirfile->field_list_by_type ($TYPE) β€” Equivalent to: "$dirfile->entry_list(undef, $TYPE, undef)". 🏷️
  • $dirfile->fragment_affixes ($FRAGMENT_INDEX) β€” Returns an array containing the prefix (first) and suffix (second) of the fragment indexed by $FRAGMENT_INDEX. See gd_fragment_affixes(3). πŸŽ€
  • $dirfile->fragments () β€” In scalar context, returns the number of metadata fragments in the dirfile. In list context, returns an array of pathnames to the fragments on disk, in the order that they're indexed. See gd_nfragments(3) and gd_fragmentname(3). πŸ—‚οΈ
  • $dirfile->get_carray ($FIELD_CODE, $RETURN_TYPE) β€” Returns the value of the CARRAY named $FIELD_CODE after converting its elements to the return type $RETURN_TYPE, which should be one of the symbols listed under "Data Types" above. If $RETURN_TYPE is $GetData::NULL, in scalar context this function returns undef. Otherwise, if called in scalar context, returns a packed string containing the data. If called in list context, the data will be unpacked and returned as an array. See gd_get_carray(3). πŸ“
  • $dirfile->get_carray_slice ($FIELD_CODE, $START, $LEN, $RETURN_TYPE) β€” Returns the value of a portion of the CARRAY named $FIELD_CODE after converting its elements to the return type $RETURN_TYPE, which should be one of the symbols listed under "Data Types" above. The first element returned is given by $START, and the number of elements by $LEN. If $RETURN_TYPE is $GetData::NULL, in scalar context this function returns undef. Otherwise, if called in scalar context, returns a packed string containing the data. If called in list context, the data will be unpacked and returned as an array. Less data than requested may be returned, if insufficient data exist. See gd_get_carray_slice(3). βœ‚οΈ
  • $dirfile->get_constant ($FIELD_CODE, $RETURN_TYPE) β€” Returns the value of the CONST named $FIELD_CODE after converting it to the return type $RETURN_TYPE, which should be one of the symbols listed under "Data Types" above. If $RETURN_TYPE is $GetData::NULL, returns undef on success. See gd_get_constant(3). πŸ’œ
  • $dirfile->getdata ($FIELD_CODE, $FIRST_FRAME, $FIRST_SAMP, $NUM_FRAMES, $NUM_SAMP, $RETURN_TYPE) β€” bestie this is THE one. It grabs data from the field $FIELD_CODE and converts it to $RETURN_TYPE, which has to be one of the symbols from Data Types up above, okurrr. The first sample it hands back is $FIRST_SAMP samples after the start of $FIRST_FRAME, and the total amount of data returned is $NUM_FRAMES frames plus $NUM_SAMP samples. ✨ Now here's the tea: if $RETURN_TYPE is $GetData::NULL, then in scalar context this thing returns the number of samples read. Otherwise, in scalar context, you get a string of packed data. And in array context? The data gets unpacked and returned as an array. πŸ’… Complex data comes back as Math::Complex objects. Go see gd_getdata(3).
  • $dirfile->get_string ($FIELD_CODE) β€” hands you the value of the STRING named $FIELD_CODE. Simple, clean, iconic. See gd_get_string(3).
  • $dirfile->include ($FILE, $PARENT_FRAGMENT, $FLAGS, [$PREFIX, $SUFFIX]) β€” pulls in the fragment metadata file $FILE under the fragment indexed by $PARENT_FRAGMENT. 🫢 $FLAGS should be a bitwise-or'd collection of zero or more of these:
$GetData::BIG_ENDIAN, $GetData::CREAT, $GetData::EXCL,
$GetData::FORCE_ENCODING, $GetData::FORCE_ENDIAN,
$GetData::IGNORE_DUPS, $GetData::IGNORE_REFS,
$GetData::LITTLE_ENDIAN, $GetData::PEDANTIC, $GetData::TRUNC,

…and at most one of the encoding symbols listed up in the Encoding Types section, or else $GetData::AUTO_ENCODED, which is basically telling GetData "girl, you figure out the encoding yourself." 😌 If $PREFIX or $SUFFIX are left out or set to undef, the fragment you're adding gets no such affix, periodt. See gd_include_affix(3).

  • $dirfile->madd_carray ($PARENT, $FIELD_NAME, $DATA_TYPE, {DATA...}) β€” adds a brand new CARRAY metafield named $FIELD_NAME under the parent field $PARENT. πŸŽ€ The storage type is $DATA_TYPE, which needs to be one of the symbols under Data Types above. Then the CARRAY's value gets set to whatever's in the {DATA...} argument list, which also decides how long it is. Check the Input Data section above for what forms {DATA...} is allowed to take. See gd_madd_carray(3).
  • $dirfile->madd_const ($PARENT, $FIELD_NAME, $DATA_TYPE, [$VALUE]) β€” adds a fresh CONST metafield called $FIELD_NAME under the field $PARENT. The $DATA_TYPE says what the storage type is (one of those Data Types symbols, you know the drill). If you give it a $VALUE, the field's value is set to that; otherwise the field starts out at zero. See gd_madd_const(3).
  • $dirfile->mcarrays ($PARENT, $RETURN_TYPE) β€” same energy as carrays() (q.v.), except it returns CARRAYs that are metafields under the parent you named in $PARENT.
  • $dirfile->mconstants ($PARENT, $RETURN_TYPE) β€” works like constants() (q.v.), but returns CONSTs that are metafields under the parent given by $PARENT.
  • $dirfile->mfield_list ($PARENT) β€” literally the same thing as $dirfile->entry_list($PARENT, undef, undef).
  • $dirfile->mfield_list_by_type ($PARENT, $TYPE) β€” exactly equivalent to $dirfile->entry_list($PARENT, $TYPE, undef).
  • $dirfile->mstrings ($PARENT) β€” behaves like strings() (q.v.), but returns STRINGs that are metafields under the parent specified by $PARENT.
  • $dirfile->mvector_list ($PARENT) β€” the same as:
$dirfile->entry_list($PARENT, $GetData::VECTOR_ENTRIES, undef).
  • $dirfile->parser_callback ($SEHANDLER, $EXTRA=undef) β€” sets the dirfile's registered parser callback function to $SEHANDLER, or to nothing if you pass undef, and updates the $EXTRA parameter too. See gd_parser_callback(3).
  • $dirfile->put_carray ($FIELD_CODE, {DATA...}) β€” sets the value of the CARRAY named $FIELD_CODE to the values in the {DATA...} argument list. πŸ¦‹ See the Input Data section above for the allowed forms of {DATA...}. See gd_put_carray(3).
  • $dirfile->put_carray_slice ($FIELD_CODE, $START, {DATA...}) β€” sets the value of the chunk of the CARRAY named $FIELD_CODE starting at element number $START to the values in the {DATA...} argument list. 🌸 Same deal β€” Input Data section above for the allowed forms of {DATA...}. See gd_put_carray_slice(3).
  • $dirfile->put_constant ($FIELD_CODE, $DATUM) β€” sets the value of the CONST field $FIELD_CODE to the value $DATUM. See gd_put_constant(3).
  • $dirfile->putdata ($FIELD_CODE, $FIRST_FRAME, $FIRST_SAMPLE, {DATA...}) β€” sets part of the vector given by $FIELD_CODE to the values in the {DATA...} argument list. The first sample written is $FIRST_SAMPLE samples after the start of $FIRST_FRAME. 🫢 Input Data section above for the allowed forms of {DATA...}. See gd_putdata(3).
  • $dirfile->strings () β€” in scalar context it gives you the number of STRING fields. In list context, it gives you an array of strings containing the values of all the STRING fields. See gd_strings(3).
  • $dirfile->strtok ($STRING) β€” tokenises $STRING and hands back an array of tokens. See gd_strtok(3).
  • $dirfile->vector_list () β€” equivalent to:
$dirfile->entry_list(undef, $GetData::VECTOR_ENTRIES, undef).

✨ Other Methods ✨

Okay so for the most part, these methods act just like their C API counterpart, no cap. πŸ“– Go read the matching C API manual page for the details. If anything behaves differently, bestie, it's called out right here.

  • $dirfile->add ($ENTRY) β€” $ENTRY should be a reference to an entry hash; peep ENTRY HASHES above. πŸ’œ
  • $dirfile->add_alias ($FIELD_CODE, $TARGET, [$FRAGMENT_INDEX]) β€” $FRAGMENT_INDEX = 0 is assumed if you don't specify it.
  • $dirfile->add_bit ($FIELD_CODE, $IN_FIELD, $BITNUM, $NUMBITS, [$FRAGMENT_INDEX]) β€” $FRAGMENT_INDEX = 0 is assumed if not specified.
  • $dirfile->add_divide ($FIELD_CODE, $IN_FIELD1, $IN_FIELD2, [$FRAGMENT_INDEX]) β€” $FRAGMENT_INDEX = 0 is assumed if not specified.
  • $dirfile->add_lincom ($FIELD_CODE, $N_FIELDS, $IN_FIELDS, $M, $B, [$FRAGMENT_INDEX]) β€” $IN_FIELDS, $M, and $B should all be references to arrays of the appropriate length. The elements of $M and $B can be any numerical type, Math::Complex included. πŸ’… $FRAGMENT_INDEX = 0 is assumed if not specified.
  • $dirfile->add_linterp ($FIELD_CODE, $IN_FIELD, $TABLE, [$FRAGMENT_INDEX]) β€” $FRAGMENT_INDEX = 0 is assumed if not specified.
  • $dirfile->add_mplex ($FIELD_CODE, $IN_FIELD, $COUNT_FIELD, $COUNT_VAL, $COUNT_MAX, [$FRAGMENT_INDEX]) β€” $FRAGMENT_INDEX = 0 is assumed if not specified.
  • $dirfile->add_multiply ($FIELD_CODE, $IN_FIELD1, $IN_FIELD2, [$FRAGMENT_INDEX]) β€” $FRAGMENT_INDEX = 0 is assumed if not specified.
  • $dirfile->add_phase ($FIELD_CODE, $IN_FIELD, $SHIFT, [$FRAGMENT_INDEX]) β€” $FRAGMENT_INDEX = 0 is assumed if not specified.
  • $dirfile->add_polynom ($FIELD_CODE, $POLY_ORD, $IN_FIELD, $A, [$FRAGMENT_INDEX]) β€” $A should be a reference to an array of numbers (any numerical type, Math::Complex included) of the appropriate length. $FRAGMENT_INDEX = 0 is assumed if not specified.
  • $dirfile->add_raw ($FIELD_CODE, $DATA_TYPE, $SPF, [$FRAGMENT_INDEX]) β€” $DATA_TYPE should be one of the symbols listed under Data Types above. $FRAGMENT_INDEX = 0 is assumed if not specified.
  • $dirfile->add_recip ($FIELD_CODE, $IN_FIELD, $DIVIDEND, [$FRAGMENT_INDEX]) β€” $DIVIDEND can be any numerical type, Math::Complex included. $FRAGMENT_INDEX = 0 is assumed if not specified.
  • $dirfile->add_sbit ($FIELD_CODE, $IN_FIELD, $BITNUM, $NUMBITS, [$FRAGMENT_INDEX]) β€” $FRAGMENT_INDEX = 0 is assumed if not specified.
  • $dirfile->add_spec ($LINE, [$FRAGMENT_INDEX]) β€” $FRAGMENT_INDEX = 0 is assumed if not specified.
  • $dirfile->add_string ($FIELD_CODE, $VALUE, [$FRAGMENT_INDEX]) β€” $FRAGMENT_INDEX = 0 is assumed if not specified.
  • $dirfile->add_window ($FIELD_CODE, $IN_FIELD, $CHECK_FIELD, $WINDOP, $THRESHOLD, [$FRAGMENT_INDEX]) β€” $WINDOP should be one of the symbols listed under WINDOW Operators above. $FRAGMENT_INDEX = 0 is assumed if not specified.
  • $dirfile->alias_target ($FIELD_CODE) β€” that's it, that's the whole thing. ✨
  • $dirfile->alter_affixes ($FRAGMENT_INDEX, $PREFIX, [$SUFFIX]) β€” if $PREFIX or $SUFFIX are undef, or if $SUFFIX is just omitted entirely, then that affix is not changed. πŸ™ˆ
  • $dirfile->alter_bit ($FIELD_CODE, [$IN_FIELD, $BITNUM, $NUMBITS]) β€” arguments you don't give or that are set to undef are not changed. And bonus: if $BITNUM == -1, or $NUMBITS == 0, that parameter also doesn't get changed. πŸŽ€
  • $dirfile->alter_carray ($FIELD_CODE, $CONST_TYPE, $ARRAY_LEN) β€” $CONST_TYPE should be one of the symbols listed under Data Types above.
  • $dirfile->alter_const ($FIELD_CODE, [$CONST_TYPE]) β€” if $CONST_TYPE is omitted, or it equals $GetData::NULL, then it's not changed; otherwise it should be one of the symbols listed under Data Types above.
  • $dirfile->alter_divide ($FIELD_CODE, [$IN_FIELD1, $IN_FIELD2]) β€” arguments not given or set to undef are not changed.
  • $dirfile->alter_encoding ($ENCODING, [$FRAGMENT_INDEX, $RECODE]) β€” both $FRAGMENT_INDEX and $RECODE default to 0 if you don't give them. πŸ’«
  • $dirfile->alter_endianness ($BYTE_SEX, [$FRAGMENT_INDEX, $RECODE]) β€” both $FRAGMENT_INDEX and $RECODE default to 0 if not given.
  • $dirfile->alter_entry ($FIELD_CODE, $ENTRY, [$RECODE]) β€” $ENTRY should be a reference to an entry hash; see ENTRY HASHES above. If you don't give $RECODE, it defaults to 0.
  • $dirfile->alter_frameoffset ($OFFSET, [$FRAGMENT_INDEX, $RECODE]) β€” both $FRAGMENT_INDEX and $RECODE default to 0 if not given.
  • $dirfile->alter_lincom ($FIELD_CODE, [$N_FIELDS, $IN_FIELDS, $M, $B]) β€” arguments not given or set to undef are not changed. If you do give them, $IN_FIELDS, $M, and $B should be references to arrays of the appropriate length.
  • $dirfile->alter_linterp ($FIELD_CODE, [$IN_FIELD, $TABLE, $RENAME_TABLE]) β€” arguments not given or set to undef are not changed. If $RENAME_TABLE isn't given, it defaults to 0.
  • $dirfile->alter_mplex ($FIELD_CODE, [$IN_FIELD, $COUNT_FIELD, $COUNT_VAL, $COUNT_MAX]) β€” arguments not given or set to undef are not changed. And heads up: if $COUNT_VAL or $COUNT_MAX are -1, that parameter is not changed either. πŸ‘‘
  • $dirfile->alter_multiply ($FIELD_CODE, [$IN_FIELD1, $IN_FIELD2]) β€” arguments not given or set to undef are not changed.
  • $dirfile->alter_phase ($FIELD_CODE, $IN_FIELD, $SHIFT) β€” if $IN_FIELD == undef, it is not changed.
  • $dirfile->alter_polynom ($FIELD_CODE, [$POLY_ORD, $IN_FIELD, $A]) β€” bestie, any argument you don't give or set to undef is not changed. And if $POLY_ORD == 0, it also doesn't change. πŸ’…
  • $dirfile->alter_protection ($PROTECTION_LEVEL, $FRAGMENT_INDEX) πŸ¦‹
  • $dirfile->alter_raw ($FIELD_CODE, [$DATA_TYPE, $SPF, $RECODE]) β€” args not given or undef stay put. Also, if $DATA_TYPE == $GetData::NULL or $SPF == 0, that parameter is not changed. If $RECODE isn't given, it defaults to 0. πŸ’–
  • $dirfile->alter_recip ($FIELD_CODE, [$IN_FIELD, $DIVIDEND]) β€” args not given or undef stay put. Also, if $DIVIDEND == 0, it is not changed. $DIVIDEND may be of any numerical type, including Math::Complex. πŸ”₯
  • $dirfile->alter_sbit ($FIELD_CODE, [$IN_FIELD, $BITNUM, $NUMBITS]) β€” args not given or undef stay put. Also, if $BITNUM == -1, or $NUMBITS == 0, that parameter is not changed. πŸ’…
  • $dirfile->alter_spec ($LINE, [$RECODE]) β€” if $RECODE isn't given, it defaults to 0. ✨
  • $dirfile->alter_window ($FIELD_CODE, $IN_FIELD, $CHECK_FIELD, $WINDOP, $THRESHOLD) β€” if $IN_FIELD or $CHECK_FIELD are undef, or if $WINDOP == $GetData::WINDOP_UNK, that parameter is not changed. Otherwise, $WINDOP should be one of the symbols listed under WINDOW Operators above. 🌈
  • $dirfile->array_len ($FIELD_CODE) 🌸
  • $dirfile->bof ($FIELD_CODE) πŸ’œ
  • $dirfile->delete ($FIELD_CODE, [$FLAGS]) β€” if $FLAGS isn't given, it defaults to 0. Otherwise, it should be a bitwise or'd collection of zero or more of these flags:
    • $GetData::DEL_DATA
    • $GetData::DEL_DEREF
    • $GetData::DEL_FORCE
    • $GetData::DEL_META
  • $dirfile->desync ([$FLAGS]) β€” if omitted, $FLAGS defaults to zero. Otherwise, it should be zero or more of these flags bitwise or'd together:
    • $GetData::DESYNC_PATHCHECK
    • $GetData::DESYNC_REOPEN
  • $dirfile->dirfilename () πŸŽ€
  • $dirfile->dirfile_standards ([$VERSION]) β€” in addition to a simple integer version number, $VERSION may be one of these symbols:
    • $GetData::VERSION_CURRENT
    • $GetData::VERSION_EARLIEST
    • $GetData::VERSION_LATEST If not given, $GetData::VERSION_CURRENT is assumed. πŸ‘‘
  • $dirfile->encoding ($FRAGMENT_INDEX) πŸ¦‹
  • $dirfile->endianness ($FRAGMENT_INDEX) 🌸
  • $dirfile->eof ($FIELD_CODE) πŸ’œ
  • $dirfile->error_count () 😭
  • $dirfile->flags ([$SET, $RESET]) β€” if omitted, $SET and $RESET default to 0. Otherwise, they should be zero or more of these flags, bitwise or'd together:
    • $GetData::PRETTY_PRINT
    • $GetData::VERBOSE
  • $dirfile->flush ($FIELD_CODE) πŸ’…
  • $dirfile->fragment_index ($FIELD_CODE) ✨
  • $dirfile->fragmentname ($FRAGMENT_INDEX) πŸŽ€
  • $dirfile->frameoffset ($FRAGMENT_INDEX) πŸ¦‹
  • $dirfile->framenum ($FIELD_CODE, $VALUE, [$START, $END]) β€” $START and $END default to 0 if not given. πŸ’–
  • $dirfile->hidden ($FIELD_CODE) πŸ™ˆ
  • $dirfile->hide ($FIELD_CODE) πŸ™ˆ
  • $dirfile->madd ($ENTRY, $PARENT) β€” $ENTRY should be a reference to an entry hash; see ENTRY HASHES above. πŸ”₯
  • $dirfile->madd_alias ($PARENT, $FIELD_CODE, $TARGET) 🌈
  • $dirfile->madd_bit ($PARENT, $FIELD_CODE, $IN_FIELD, $BITNUM, $NUMBITS) πŸ’…
  • $dirfile->madd_divide ($PARENT, $FIELD_CODE, $IN_FIELD1, $IN_FIELD2) πŸ’œ
  • $dirfile->madd_lincom ($PARENT, $FIELD_CODE, $N_FIELDS, $IN_FIELDS, $M, $B) β€” $IN_FIELDS, $M, and $B should be references to arrays of the appropriate length. The elements of $M and $B may be of any numerical type, including Math::Complex. πŸ”₯
  • $dirfile->madd_linterp ($PARENT, $FIELD_CODE, $IN_FIELD, $TABLE) ✨
  • $dirfile->madd_mplex ($PARENT, $FIELD_CODE, $IN_FIELD, $COUNT_FIELD, $COUNT_VAL, $COUNT_MAX) 🌸
  • $dirfile->madd_multiply ($PARENT, $FIELD_CODE, $IN_FIELD1, $IN_FIELD2) πŸ’…
  • $dirfile->madd_phase ($PARENT, $FIELD_CODE, $IN_FIELD, $SHIFT) πŸ¦‹
  • $dirfile->madd_polynom ($PARENT, $FIELD_CODE, $POLY_ORD, $IN_FIELD, $A) β€” $A should be a reference to an array of numbers (of any numerical type, including Math::Complex) of the appropriate length. πŸ‘‘
  • $dirfile->madd_recip ($PARENT, $FIELD_CODE, $IN_FIELD, $DIVIDEND) β€” $DIVIDEND may be of any numerical type, including Math::Complex. πŸ”₯
  • $dirfile->madd_sbit ($PARENT, $FIELD_CODE, $IN_FIELD, $BITNUM, $NUMBITS) πŸ’œ
  • $dirfile->madd_spec ($LINE, $PARENT) πŸŽ€
  • $dirfile->madd_string ($PARENT, $FIELD_CODE, $VALUE) 🌈
  • $dirfile->madd_window ($PARENT, $FIELD_CODE, $IN_FIELD, $CHECK_FIELD, $WINDOP, $THRESHOLD) β€” $WINDOP should be one of the symbols listed under WINDOW Operators above. ✨
  • $dirfile->malter_spec ($LINE, $PARENT, [$RECODE]) β€” if $RECODE isn't given, it defaults to 0. πŸ’…
  • $dirfile->metaflush () 🧚
  • $dirfile->move ($FIELD_CODE, $NEW_FRAGMENT, [$MOVE_DATA]) β€” if not given, $FLAGS defaults to 0. Otherwise, it should be a bitwise or'd collection of zero or more of these flags:
    • $GetData::REN_DANGLE
    • $GetData::REN_DATA
    • $GetData::REN_FORCE
    • $GetData::REN_UPDB
  • $dirfile->mplex_lookback ($LOOKBACK) 🌸
  • $dirfile->native_type ($FIELD_CODE) β€” the returned value will be one of the symbols listed above under Data Types. πŸ‘‘
  • $dirfile->nframes () πŸ’–
  • $dirfile->parent_fragment ($FRAGMENT_INDEX) πŸ¦‹
  • $dirfile->protection ($FRAGMENT_INDEX) πŸŽ€
  • $dirfile->put_string ($FIELD_CODE, $STRING) ✨
  • $dirfile->raw_close ($FIELD_CODE) πŸ’…
  • $dirfile->raw_filename ($FIELD_CODE) 🌈
  • $dirfile->reference ([$FIELD_CODE]) β€” if $FIELD_CODE is not given or undef, this function simply reports the current reference field. πŸ”₯
  • $dirfile->rename ($OLD_CODE, $NEW_NAME, [$FLAGS]) β€” if not given, $FLAGS defaults to 0. Otherwise, it should be a bitwise or'd collection of zero or more of these flags:
    • $GetData::REN_DANGLE
    • $GetData::REN_DATA
    • $GetData::REN_FORCE
    • $GetData::REN_UPDB
  • $dirfile->rewrite_fragment ($FRAGMENT_INDEX) πŸ’œ
  • $dirfile->seek ($FIELD_CODE, $FRAME_NUM, $SAMPLE_NUM, [$FLAGS]) β€” if not given, $FLAGS defaults to $GetData::SEEK_SET. Otherwise, it should be one of:
    • $GetData::SEEK_CUR
    • $GetData::SEEK_END
    • $GetData::SEEK_SET Furthermore, this value should be bitwise or'd with $GetData::SEEK_WRITE if the next operation on the field is a write (via "putdata"). 🫢
  • $dirfile->spf ($FIELD_CODE) 🌸
  • $dirfile->sync ($FIELD_CODE) ✨
  • $dirfile->tell ($FIELD_CODE) πŸ’…
  • $dirfile->unhide ($FIELD_CODE) πŸ™ˆ
  • $dirfile->uninclude ($FRAGMENT_INDEX, [$DEL]) β€” if not given, $DEL defaults to 0. πŸ’–
  • $dirfile->validate ($FIELD_CODE) πŸ‘‘
  • $dirfile->verbose_prefix ([$PREFIX]) β€” if $PREFIX is omitted or undef, the prefix is removed. πŸ¦‹

< purple>Copyright (C) 2012-2015 D. V. Wiebe

GetData is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation: either version 2.1 of the License, or (at your option) any later version.

GetData is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the GNU Lesser General Public License for more details.

πŸ‘€ SEE ALSO πŸ‘€


This page was served fresh from perl v5.40.1, dated 2025-02-21, and it's the GetData(3pm) manual. Stay iconic, bestie. πŸ’–βœ¨

πŸ“¦ where this page comes from