NAME

WebFetch::Input::PerlStruct - accept a Perl structure with pre-parsed news into WebFetch

VERSION

version 0.15.9

SYNOPSIS

In perl scripts:

use WebFetch::Input::PerlStruct;

$obj = WebFetch::Input::PerlStruct->new(
    "content" => content_struct,
    "dir" => output_dir,
    "dest" => output_file,
    "dest_format" => output_format,	# used to select WebFetch output module
    [ "group" => file_group_id, ]
    [ "mode" => file_mode_perms, ]
    [ "quiet" => 1 ]);

Note: WebFetch::Input::PerlStruct is a Perl interface only. It does not support usage from the command-line.

DESCRIPTION

This module accepts a perl structure with pre-parsed news and pushes it into the WebFetch infrastructure.

The webmaster of a remote site only needs to arrange for a cron job to update a WebFetch Export file, and let others know the URL to reach that file. (On the exporting site, it is most likely they'll use WebFetch::SiteNews to export their own news.) Then you can use the WebFetch::Input::PerlStruct module to read the remote file and generate and HTML summary of the news.

After WebFetch::Input::PerlStruct runs, the file specified in the --file parameter will be created or replaced. If there already was a file by that name, it will be moved to a filename with "O" (for old) prepended to the file name.

Most of the parameters listed are inherited from WebFetch. See the WebFetch module documentation for details.

THE CONTENT STRUCTURE

The $content_struct parameter may be in either of two formats.

If $content_struct is a hash reference containing entries called "fields", "wk_names" and "records", then it is assumed to be already in the format of the "data" element of the WebFetch Embedding API.

Otherwise, it must be a reference to an array of hashes. Each of the hashes represents a separate news item, in the order they should be displayed.

The field names should be consistent through all records. WebFetch uses the field names from the first record and assumes the remainder are identical.

The names of the fields are chosen by the calling function. If an array called "wk_names" is provided then it used to map well-known field names of the WebFetch Embedding API to field names in this data. Otherwise, meaning can only be applied to field names if they already match WebFetch's well-known field names.

SEE ALSO

WebFetch 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