2 # Plug.pl: hacked for http://Plug.org/ by Tim Riker <Tim@Rikers.org>
3 # Slashdot.pl: Slashdot headline retrival
4 # Author: Chris Tessone <tessone@imsa.edu>
6 # Licensing: Artistic License (as perl itself)
7 # Version: v0.4 (19991125)
11 # fixed up to use XML'd /. backdoor 7/31 by richardh@rahga.com
12 # My only request if this gets included in infobot is that the
13 # other header gets trimmed to 2 lines, dump the fluff ;) -rah
15 # added a status message so people know to install LWP - oznoid
16 # also simplified the return code because it wasn't working.
28 next unless (/<title>(.*?)<\/title>/);
30 $title =~ s/&\;/&/g;
31 push( @list, $title );
38 my @results = &::getURL("http://www.plug.org/index.xml");
39 my $retval = "i could not get the headlines.";
41 if ( scalar @results ) {
42 my $prefix = 'Plug Headlines ';
43 my @list = &plugParse(@results);
44 $retval = &::formListReply( 0, $prefix, @list );
47 &::performStrictReply($retval);
51 my $file = "$::param{tempDir}/plug.xml";
53 my @Cxml = &::getURL("http://www.plug.org/index.xml");
54 if ( !scalar @Cxml ) {
55 &::DEBUG("sdA: failure (Cxml == NULL).");
59 if ( !-e $file ) { # first time run.
60 open( OUT, ">$file" );
77 my @Chl = &plugParse(@Cxml);
78 my @Ohl = &plugParse(@Oxml);
82 last if ( $_ eq $Ohl[0] );
86 if ( scalar @new == 0 ) {
87 &::status("Plug: no new headlines.");
91 if ( scalar @new == scalar @Chl ) {
92 &::DEBUG("sdA: scalar(new) == scalar(Chl). bad?");
95 open( OUT, ">$file" );
101 return "Plug: " . join( " \002::\002 ", @new );
106 # vim:ts=4:sw=4:expandtab:tw=80