WebFetch::PerlStruct - accepts a Perl structure with pre-parsed news


NAME

WebFetch::PerlStruct - accepts a Perl structure with pre-parsed news


SYNOPSIS

In perl scripts:

use WebFetch::PerlStruct;

$obj = new WebFetch::PerlStruct (
"content" = content_struct,
``dir'' => output_dir,
``file'' => output_file,
[ ``format'' => format_string, ]
[ ``export'' => wf_export_filename, ]
[ ``ns_export'' => ns_export_filename, ]
[ ``ns_export'' => ns_export_filename, ]
[ ``ns_export'' => ns_export_filename, ]
[ ``ns_site_title'' => ns_export_site_title, ]
[ ``ns_site_link'' => ns_export_site_link, ]
[ ``ns_site_desc'' => ns_export_site_desc, ]
[ ``ns_image_title'' => ns_export_image_title, ]
[ ``ns_image_url'' => ns_export_image_url, ]
[ ``font_size'' => font_size, ]
[ ``font_face'' => font_face, ]
[ ``group'' => file_group_id, ]
[ ``mode'' => file_mode_perms, ]
[ ``quiet'' => 1 ]);>

Note: WebFetch::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::PerlStruct module to read the remote file and generate and HTML summary of the news.

After WebFetch::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 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 fields of each has entry must provide enough information to match field names in all the the output formats you're using. Output formats include the following:

HTML output file
All the fields used in the $format_string (see below) must be present for generation of the HTML output.

WebFetch export
The $format_string also determines the fields that will be used for WebFetch export. Note that the WebFetch::General module expects by default to find fields called ``url'' and ``title''. So if you use something different from the default, you must provide your format string in the instructions for sites that fetch news from you. (Otherwise their WebFetch::General won't be looking for the fields you're providing.)

MyNetscape export
The MyNetscape export function expects to find fields called ``title'' and ``url'', and will skip any hash entry which is missing either of them.


FORMAT STRINGS

WebFetch::PerlStruct uses a format string identical to WebFetch::General. The default format for retrieved data is

<a href=``%url%''>%title%</a>

See the WebFetch::General documentation for more details.

The names of the fields are chosen by the calling function. Though for the convenience of the user, the author of an exporting module should keep in mind the default WebFetch::PerlStruct format uses fields called ``url'' and ``title''. If you use fields by different names, make sure your code provides those fields in the $content_struct parameter.


AUTHOR

WebFetch was written by Ian Kluft for the Silicon Valley Linux User Group (SVLUG). Send patches, bug reports, suggestions and questions to maint@webfetch.org.


SEE ALSO

WebFetch

 WebFetch::PerlStruct - accepts a Perl structure with pre-parsed news