The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

HTML::Latemp::News - News Maintenance Module for Latemp (and possibly other web frameworks)

VERSION

version 0.2.2

SYNOPSIS

    #!/usr/bin/perl

    use strict;
    use warnings;

    use MyManageNews;

    my @news_items =
    (
        .
        .
        .
        {
            'title' => "Changes of 18-April-2005",
            'id' => "changes-2005-04-18",
            'description' => q{Around 18 April, 2005, Jane's Site has seen a
                lot of changes. Click the link for details on them.},
            'date' => "2005-04-18",
            'author' => "Jane Smith",
            'category' => "Jane's Site",
        },
        .
        .
        .
    );

    my $news_manager =
        HTML::Latemp::News->new(
            'news_items' => \@news_items,
            'title' => "Better SCM News",
            'link' => "http://janes-site.tld/",
            'language' => "en-US",
            'copyright' => "Copyright by Jane Smith, (c) 2005",
            'webmaster' => "Jane Smith <jane@janes-site.tld>",
            'managing_editor' => "Jane Smith <jane@janes-site.tld>",
            'description' => "News of Jane's Site - a personal site of " .
                "Jane Smith",
        );

    $news_manager->generate_rss_feed(
        'output_filename' => "dest/rss.xml"
    );

    1;

DESCRIPTION

This is a module that maintains news item for a web-site. It can generate an RSS feed, as well as a news page, and an HTML newsbox, all from the same data.

FUNCTIONS

HTML::Latemp::News->new(...)

This is the constructor for the news manager. It accepts the following named parameters:

'news_items'

This is a reference to a list of news_items. See below.

'title'

The title of the RSS feed.

'link'

The link to the homepage of the site.

'language'

The language of the text.

'copyright'

The copyright notice of the text.

'webmaster'

The Webmaster.

'managing_editor'

The managing editor.

'description'

A description of the news feed as will be put in the RSS feed.

Format of the news_items

The news_items is a reference to an array, of which each element is a hash reference. The hash may contain the following keys:

'title'

The title of the item.

'id'

The ID of the item. This will also be used to calculate URLs.

'description'

A text description explaining what the item is all about.

'author'

The author of the item.

'date'

A string representing the daet.

'category'

The cateogry of the item.

$news_manager->generate_rss_feed('output_filename' => "rss.xml")

This generates an RSS feed. It accepts two named arguments. 'output_filename' is the name of the RSS file to write to. 'num_items' is the number of items to include, which defaults to 10.

$news_manager->get_navmenu_items('num_items' => 5)

This generates navigation menu items for input to the navigation menu of HTML::Widgets::NavMenu. It accepts a named argument 'num_items' which defaults to 10.

$news_manager->get_news_page_entries('num_items' => 5, 'base_url' => "news/")

This generates HTML for the news page. 'base_url' points to a URL to be appended to each item's ID.

$news_manager->get_news_box('num_items' => 5)

This generates an HTML news box with the recent headlines.

AUTHOR

Shlomi Fish, http://www.shlomifish.org/ .

SEE ALSO

XML::RSS, HTML::Widgets::NavMenu .

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2005 Shlomi Fish.

This program is free software; you can redistribute it and/or modify it under the terms of the MIT / Expat license.

SUPPORT

Websites

The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources.

Bugs / Feature Requests

Please report any bugs or feature requests by email to bug-html-latemp-news at rt.cpan.org, or through the web interface at https://rt.cpan.org/Public/Bug/Report.html?Queue=HTML-Latemp-News. You will be automatically notified of any progress on the request by the system.

Source Code

The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :)

https://github.com/shlomif/html-latemp-news

  git clone git://github.com/shlomif/html-latemp-news.git

AUTHOR

Shlomi Fish <shlomif@cpan.org>

BUGS

Please report any bugs or feature requests on the bugtracker website https://github.com/shlomif/html-latemp-news/issues

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

COPYRIGHT AND LICENSE

This software is Copyright (c) 2005 by Shlomi Fish.

This is free software, licensed under:

  The MIT (X11) License