<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#webliberty::Rss.pm (2006/02/18)
#Copyright(C) 2002-2006 Knight, All rights reserved.

package webliberty::Rss;

use strict;

### ã‚³ãƒ³ã‚¹ãƒˆãƒ©ã‚¯ã‚¿
sub new {
	my $class = shift;

	my $self = {
		rss_data    =&gt; undef,
		rdf_about   =&gt; undef,
		link        =&gt; undef,
		description =&gt; undef,
		items       =&gt; undef
	};
	bless $self, $class;

	return $self;
}

### RSSãƒ‡ãƒ¼ã‚¿ä½œæˆ
sub create_rss {
	my $self = shift;
	my %args = @_;

	$self-&gt;{rdf_about}   = $args{'rdf_about'};
	$self-&gt;{title}       = $args{'title'};
	$self-&gt;{link}        = $args{'link'};
	$self-&gt;{description} = $args{'description'};
	$self-&gt;{date}        = $args{'date'};
	$self-&gt;{items}       = $args{'items'};

	$self-&gt;{rdf_about} =~ s/~/%7E/g;
	$self-&gt;{link}      =~ s/~/%7E/g;

	if ($self-&gt;{date} =~ /^(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/) {
		$self-&gt;{date} = "$1-$2-$3" . "T$4:$5+09:00";
	}

	$self-&gt;{rss_data} = &lt;&lt;"_RSS_";
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;rdf:RDF xmlns="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xml:lang="ja"&gt;
	&lt;channel rdf:about="$self-&gt;{rdf_about}"&gt;
		&lt;title&gt;$self-&gt;{title}&lt;/title&gt;
		&lt;link&gt;$self-&gt;{link}&lt;/link&gt;
		&lt;description&gt;$self-&gt;{description}&lt;/description&gt;
		&lt;dc:language&gt;ja&lt;/dc:language&gt;
		&lt;dc:date&gt;$self-&gt;{date}&lt;/dc:date&gt;
		&lt;items&gt;
			&lt;rdf:Seq&gt;
_RSS_

	foreach (split(/\n/, $self-&gt;{items})) {
		my($title, $link, $description, $date) = split(/\t/);

		$link =~ s/~/%7E/g;

		$self-&gt;{rss_data} .= &lt;&lt;"_RSS_";
			&lt;rdf:li rdf:resource="$link" /&gt;
_RSS_
	}

	$self-&gt;{rss_data} .= &lt;&lt;"_RSS_";
			&lt;/rdf:Seq&gt;
		&lt;/items&gt;
	&lt;/channel&gt;
_RSS_

	foreach (split(/\n/, $self-&gt;{items})) {
		my($title, $link, $description, $date) = split(/\t/);

		$link =~ s/~/%7E/g;

		$description = (split(/&lt;br \/&gt;/, $description))[0];
		$description =~ s/&lt;[^&gt;]*&gt;//g;
		$description =~ s/&amp;lt;[^(&amp;gt;)]*&amp;gt;//g;
		$description =~ s/&amp;/&amp;amp;/g;

		if ($date =~ /^(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/) {
			$date = "$1-$2-$3" . "T$4:$5+09:00";
		}

		$self-&gt;{rss_data} .= &lt;&lt;"_RSS_";
	&lt;item rdf:about="$link"&gt;
		&lt;title&gt;$title&lt;/title&gt;
		&lt;link&gt;$link&lt;/link&gt;
		&lt;description&gt;$description&lt;/description&gt;
		&lt;dc:date&gt;$date&lt;/dc:date&gt;
	&lt;/item&gt;
_RSS_
	}

	$self-&gt;{rss_data} .= &lt;&lt;"_RSS_";
&lt;/rdf:RDF&gt;
_RSS_

	return $self-&gt;{rss_data};
}

1;
</pre></body></html>