2 # Slashdot.pl: Slashdot headline retrival
3 # Author: Chris Tessone <tessone@imsa.edu>
5 # Licensing: Artistic License (as perl itself)
6 # Version: v0.4 (19991125)
10 # fixed up to use XML'd /. backdoor 7/31 by richardh@rahga.com
11 # My only request if this gets included in infobot is that the
12 # other header gets trimmed to 2 lines, dump the fluff ;) -rah
14 # added a status message so people know to install LWP - oznoid
15 # also simplified the return code because it wasn't working.
26 next unless (/<title>(.*?)<\/title>/);
28 $title =~ s/&\;/&/g;
29 push( @list, $title );
36 my @results = &::getURL("http://slashdot.org/slashdot.xml");
37 my $retval = "i could not get the headlines.";
39 if ( scalar @results ) {
40 my $prefix = 'Slashdot Headlines ';
41 my @list = &slashdotParse(@results);
42 $retval = &::formListReply( 0, $prefix, @list );
45 &::performStrictReply($retval);
48 sub slashdotAnnounce {
49 my $file = "$::param{tempDir}/slashdot.xml";
51 my @Cxml = &::getURL("http://slashdot.org/slashdot.xml");
52 if ( !scalar @Cxml ) {
53 &::DEBUG("sdA: failure (Cxml == NULL).");
57 if ( !-e $file ) { # first time run.
58 open( OUT, ">$file" );
75 my @Chl = &slashdotParse(@Cxml);
76 my @Ohl = &slashdotParse(@Oxml);
80 last if ( $_ eq $Ohl[0] );
84 if ( scalar @new == 0 ) {
85 &::status("Slashdot: no new headlines.");
89 if ( scalar @new == scalar @Chl ) {
90 &::DEBUG("sdA: scalar(new) == scalar(Chl). bad?");
93 open( OUT, ">$file" );
99 return "Slashdot: News for nerds, stuff that matters -- "
100 . join( " \002::\002 ", @new );
105 # vim:ts=4:sw=4:expandtab:tw=80