NAME
WebFetch::Data::Store - WebFetch Embedding API top-level data store
VERSION
version 0.15.9
SYNOPSIS
use WebFetch::Data::Store;
$data = webfetch_obj->data;
$data->add_fields( "field1", "field2", ... );
$num = $data->num_fields;
@field_names = $data->get_fields;
$name = $data->field_bynum( 3 );
$data->add_wk_names( "title" => "heading", "url" => "link", ... );
$value = $data->get_feed( $name );
$data->set_feed( $name, $value );
$data->add_record( $field1, $field2, ... ); # order corresponds to add_fields
$num = $data->num_records;
$record = $data->get_record( $n );
$data->reset_pos;
$record = $data->next_record;
$name = $data->wk2fname( $wk_name );
$num = $data->fname2fnum( $field_name );
$num = $data->wk2fnum( $wk_name );
DESCRIPTION
This module provides access to the WebFetch data. WebFetch instantiates the object for the input module. The input module uses this to construct the data set from its input. The output module uses the this to access the data and produce its output object/format.
- $obj->add_fields( "field1", "field2", ... );
-
Add the field names in the order their values will appear in the data table.
- $num = $obj->num_fields;
-
Returns the number of fields/columns in the data.
- @field_names = $obj->get_fields;
-
Gets a list of the field names in the order their values appear in the data table;
- $field_name = $obj->field_bynum( $num );
-
Return a field name string based on the numeric position of the field.
- $obj->add_wk_names( "title" => "heading", "url" => "link", ... );
-
Add associations between WebFetch well-known field names, which allows WebFetch to apply meaning to these fields, such as titles, dates and URLs. The parameters are pairs of well-known and actual field names. Running this function more than once will add to the existing associations of well-known to actual field names.
- $value = $obj->get_feed( $name );
-
Get an item of per-feed data by name.
- $obj->set_feed( $name, $value );
-
Set an item of per-feed data by name and value.
- $obj->add_record( $value1, $value2, $value3, ... );
-
Add a row to the end of the data table. Values must correspond to the positions of the field names that were provided earlier.
- $num = $obj->num_records;
-
Get the number of records/rows in the data table.
- $record = get_record( $num );
-
Returns a WebFetch::Data::Record object for the row located by the given row number in the data table. The first row is numbered 0. Calling this function does not affect the position used by the next_record function.
- $obj->reset_pos;
-
Reset the position counter used by the next_record function back to the beginning of the data table.
- $record = $obj->next_record;
-
The first call to this function returns the first record. Each successive call to this function returns the following record until the end of the data table. After the last record, the function returns undef until reset_pos is called to reset it back to the beginning.
- $obj->wk2fname( $wk )
-
Obtain a field name from a well-known name.
- $obj->fname2fnum( $fname )
-
Obtain a field number from a field name.
- $obj->wk2fnum( $wk )
-
Obtain a field number from a well-known name.
SEE ALSO
WebFetch, WebFetch::Data::Record https://github.com/ikluft/WebFetch
BUGS AND LIMITATIONS
Please report bugs via GitHub at https://github.com/ikluft/WebFetch/issues
Patches and enhancements may be submitted via a pull request at https://github.com/ikluft/WebFetch/pulls
AUTHOR
Ian Kluft <https://github.com/ikluft>
COPYRIGHT AND LICENSE
This software is Copyright (c) 1998-2023 by Ian Kluft.
This is free software, licensed under:
The GNU General Public License, Version 3, June 2007