Apache-RSS

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

	* refactoring the code

2002-05-17  IKEBE Tomohiro  <ikebe@edge.co.jp>

	* DIR_MERGE works correctly.
	* added RSSOrderBy directive.

2002-05-10  IKEBE Tomohiro  <ikebe@edge.co.jp>

	* RSSHTMLRegexp is obsolete. use subreq to determine text/html.
	* escape some elements. (eg. title, description)
	* fixed docs.

2002-05-09  IKEBE Tomohiro  <ikebe@edge.co.jp>

	* lib/Apache/RSS.pm: fixed docs. 
	* original version

lib/Apache/RSS.pm  view on Meta::CPAN

# $Id: RSS.pm,v 1.6 2002/05/30 14:08:03 ikechin Exp $

use strict;
use Apache::Constants qw(:common &OPT_INDEXES &DECLINE_CMD);
use Time::Piece;
use XML::RSS;
use DirHandle;
use URI;
use DynaLoader ();
use Apache::ModuleConfig;
use Apache::Util qw(escape_html);
use vars qw($VERSION);

$VERSION = '0.05';

if($ENV{MOD_PERL}) {
    no strict;
    @ISA = qw(DynaLoader);
    __PACKAGE__->bootstrap($VERSION);
}

lib/Apache/RSS.pm  view on Meta::CPAN

	$cfg->{'RSSChannelTitle'} || sprintf("Index Of %s", $r->uri);
    my $channel_description = 
	$cfg->{'RSSChannelDescription'} || sprintf("Index Of %s", $r->uri);
    my $copyright =
	$cfg->{'RSSCopyRight'} || sprintf("Copyright %d %s", $req_time->year, $r->hostname);
    my $language = $cfg->{'RSSLanguage'} || "en-us";
    my $encoding = $cfg->{'RSSEncoding'} || "UTF-8";

    my $rss = XML::RSS->new(version => '0.91', encoding => $encoding);
    $rss->channel(
	title => escape_html($channel_title),
	link => $base,
	description => escape_html($channel_description),
	webMaster => $r->server->server_admin,
	pubDate => $req_time->datetime,
	lastBuildDate => $req_time->datetime,
	copyright => escape_html($copyright),
	language => $language,
    );
    foreach my $item (@$items) {
	$rss->add_item(
	    link => $item->link,
	    title => escape_html($item->title),
	);
    }
    return $rss;
}

sub find_title {
    my($subr, $cfg) = @_;
    my $encoder = $cfg->{'RSSEncodeHandler'};
    if ($subr->content_type =~ m#^text/html#) {
	local $/ = undef;

t/03_default.t  view on Meta::CPAN


use Apache::RSS;
use Apache::Constants qw(:common);
use Apache::ModuleConfig;

{
    *Apache::Constants::DECLINED = sub {-1};
    *Apache::Constants::FORBIDDEN = sub {403};
    *Apache::Constants::OK = sub {0};
    *Apache::Constants::OPT_INDEXES = sub {1};
    *Apache::Util::escape_html = sub{shift};
}


{
    package Apache::ModuleConfig;
    sub get{
	Apache::RSS::DIR_CREATE('MockConf');
    }
}

t/04_title.t  view on Meta::CPAN


use Apache::RSS;
use Apache::Constants qw(:common);
use Apache::ModuleConfig;

{
    *Apache::Constants::DECLINED = sub {-1};
    *Apache::Constants::FORBIDDEN = sub {403};
    *Apache::Constants::OK = sub {0};
    *Apache::Constants::OPT_INDEXES = sub {1};
    *Apache::Util::escape_html = sub{shift};
}


{
    package Apache::ModuleConfig;
    sub get{
	my $conf = Apache::RSS->DIR_CREATE;
	$conf->{RSSScanHTMLTitle} = 1;
	return $conf;
    }

t/05_order.t  view on Meta::CPAN


use Apache::RSS;
use Apache::Constants qw(:common);
use Apache::ModuleConfig;

{
    *Apache::Constants::DECLINED = sub {-1};
    *Apache::Constants::FORBIDDEN = sub {403};
    *Apache::Constants::OK = sub {0};
    *Apache::Constants::OPT_INDEXES = sub {1};
    *Apache::Util::escape_html = sub{shift};
}


{
    package Apache::ModuleConfig;
    sub get{
	my $conf = Apache::RSS->DIR_CREATE;
	$conf->{RSSScanHTMLTitle} = 1;
	return $conf;
    }



( run in 0.777 second using v1.01-cache-2.11-cpan-c21f80fb71c )