+ $self->{-inc} = $inc;
+ my $dp=0;
+ my $pos;
+ for ($pos=index($inc,'/');$pos>=0;
+ $pos=index($inc,'/',$pos+1)) {
+ $dp++;
+ }
+ $self->{-depth} = $dp;
+ for ($pos=length($fullpath);$dp>0 && $pos>0;
+ $pos=rindex($fullpath,'/',$pos-1)) {
+ $dp--;
+ }
+ my $relpath = substr($fullpath,$pos);
+ $relpath =~ s%^/%%;
+ $relpath .= '/' if ($relpath);
+ $self->{-relpath} = $relpath;
+ $self->{-toppath} = substr($fullpath,0,$pos);
+ #print "rel=$relpath, top=$self->{-toppath}, inc=$inc\n";
+ initfeed($self);
+ } else {
+ $self->{-inc} = 'NO-.INCLUDE-IN-PATH/'; # won't work anyway
+ $self->{-feed} = '';
+ $self->{-relpath} = '';
+ $self->{-depth} = 0;
+ }
+}
+
+sub initfeed {
+ my $self=shift; # this is not a method but we cheat
+ my $fullpath=$self->{-fullpath};
+ my $toppath=$self->{-toppath};
+ my $inc=$self->{-inc}.$incdir.'/';
+ my $conffile=$toppath.'/'.$incdir.'/feed.conf';
+ my $CONF;
+
+ if (! $incpath) {
+ if ($feed) {
+ if (open($CONF,">".$conffile)) {
+ print $CONF $feed,"\n";
+ close($CONF);
+ } else {
+ print STDERR "could not open $conffile: $!\n";
+ }
+ } else {
+ if (open($CONF,$conffile)) {
+ $feed=<$CONF>;
+ close($CONF);
+ chop $feed;
+ }
+ }
+ }
+
+ return unless ($feed);
+
+ my ($feedfile, $feedbase, $feedhub) = split(',', $feed);
+ $feedbase .= '/' unless ($feedbase =~ /\/$/);
+ print "($feedfile, $feedbase, $feedhub)\n";
+
+ $feedobj->{-savepath} = $self->{-toppath}.'/'.$feedfile;
+ $feedobj->{-file} = $feedfile;
+ $feedobj->{-base} = $feedbase;
+ $feedobj->{-hub} = $feedhub;
+ $feedobj->{-feed} = XML::FeedPP::Atom::Atom10->new;
+ if ( -f $feedobj->{-file} ) {
+ $feedobj->{-feed}->load($feedobj->{-file});
+ $feedobj->{-feed}->limit_item(15);