#!/usr/bin/perl
# Time-stamp: "2008-05-31 22:18:05 ADT"
#
# See http://www.interglacial.com/rss/ for info on RSS feeds

use strict;
use XML::RSS::SimpleGen 12;
use constant DEBUG => $ENV{'MAILTO'} ? 0 : 1;
  # to test whether we're under crontab

rss_new(
 'http://www.waylay.com/',
 "Carol Lay",
 'Carol Lay draws it, you totally read it, no questions asked.'
);
rss_daily();
rss_self_url(      "http://interglacial.com/rss/carol_lay.rss" );
rss_generator_url( "http://interglacial.com/rss/carol_lay.pl" );
rss_livejournal( 'carol_lay' );

rss_item_limit(5);
get_url(
  my $firsturl = 'http://www.waylay.com/Store/OrigPages/Originals.html'
);

if(
  m{
    <a\s+href="((\d+)\.html)"><img\s+src="\.\./\.\./Images/BackBtn\.gif"
  }x
) {
  my($u, $n) = ("http://www.waylay.com/Store/OrigPages/$1", $2);
  my $title = "Carol Lay ~ strip #$2";
  
  get_url($u);
  if(
   m{<input type="hidden" name="item_name" value="Story Minute #.*?:\s*([^"<>]*?)">} 
  ) {
    $title .= ": $1";
  }
  DEBUG and print "$u $title\n";
  rss_item($u, $title);
} else {
  DEBUG and print "No backlink found on $firsturl\n";
}

rss_item_count or die "$0: Nothing found in here! {{\n$_\n}}\nAborting";
rss_save("carol_lay.rss", 17);

DEBUG > 1 and print "\n", rss_as_string, "\n";
DEBUG and print "\nEnd.\n";
exit;


__END__
