-sub initrss {
- my $self=shift; # this is not a method but we cheat
- my $fullpath=$self->{-fullpath};
- my $inc=$self->{-inc}.$incdir.'/';
- my $conffile=$self->{-toppath}.'/'.$incdir.'/rss.conf';
- my $CONF;
-
- if ($rssfile) {
- if (open($CONF,">".$conffile)) {
- print $CONF "file: ",$rssfile,"\n";
- close($CONF);
- } else {
- print STDERR "could not open $conffile: $!\n";
- }
- } else {
- if (open($CONF,$conffile)) {
- my $ln=<$CONF>;
- close($CONF);
- chop $ln;
- my ($k,$v)=split(':', $ln);
- $k =~ s/^\s*//;
- $k =~ s/\s*$//;
- $v =~ s/^\s*//;
- $v =~ s/\s*$//;
- if ($k eq 'file') {
- $rssfile=$v;
- }
- }
- }
-
- return unless ($rssfile);
-
- $rssobj->{'file'} = $self->{-toppath}.'/'.$rssfile;
- $rssobj->{'rss'} = new XML::RSS (version=>'2.0');
- if ( -f $rssobj->{'file'} ) {
- $rssobj->{'rss'}->parsefile($rssobj->{'file'});
- my $itemstodel = @{$rssobj->{'rss'}->{'items'}} - 15;
- while ($itemstodel-- > 0) {
- pop(@{$rssobj->{'rss'}->{'items'}})
- }
- $rssobj->{'rss'}->save($rssobj->{'file'});
- } else {
- my $link="";
- for (my $pos=index($rssfile,'/');$pos>=0;
- $pos=index($rssfile,'/',$pos+1)) {
- $link = '../'.$link;
- }
-
- $rssobj->{'rss'}->channel(
- title=>'Gallery',
- link=>$link,
- description=>'Gallery Feed',
- #language=>$language,
- #rating=>$rating,
- #copyright=>$copyright,
- #pubDate=>$pubDate,
- #lastBuildDate=>$lastBuild,
- #docs=>$docs,
- #managingEditor=>$editor,
- #webMaster=>$webMaster
- );
- $rssobj->{'rss'}->save($rssobj->{'file'});
- }
- $self->{-rss} = $rssobj->{'rss'};
-}
-