Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Mail newest nodes

by Beatnik (Parson)
on Apr 25, 2001 at 18:01 UTC ( #75451=CUFP: print w/replies, xml ) Need Help??

This code basically grabs the Newest Nodes XML, grabs each node and mails it...
#!/usr/bin/perl -w use strict; use XML::Parser; use LWP::Simple; use MIME::Lite; my $parser = new XML::Parser ( Handlers => { Start => \&hdl_start, Cha +r => \&hdl_char}); my $id = undef; my %Nodes = (); my $type = undef; my $xml_stream = get(" +xml+generator"); $parser->parse($xml_stream); foreach my $key (keys %Nodes) { my $page = get("$key"); my $msg = MIME::Lite->new( From =>'', To =>'', Subject => "Perlmonks Node $Nodes{$key}", Data => "Perlmonks Newest Nodes" ); $msg->attach(Type =>'text/html', Data =>$page); $msg->send; print "Sending part $Nodes{$key}\n"; } sub hdl_start{ my ($p, $elt, %atts) = @_; $type = $elt; if ($type eq "NODE") { $id = $atts{node_id}; } } sub hdl_char { my ($p, $str) = @_; $str =~ s/\n//g; if ($type eq "NODE" && $str) { #print $id," => ",$str,"\n"; $Nodes{$id} = $str; } }
  • Skip duplicate nodes
Ofcourse this could be used as base for an NNTP link...

... Quidquid perl dictum sit, altum viditur.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://75451]
Approved by root
[stevieb]: I am thankful that I fell into Perl years ago in the manner I did. I don't believe there is another language that people care about so much, that they're willing to give everything. Langs come and go, but in Perl, it seems, things remain consistent.
[stevieb]: The people back then (~2000) are the same people now, but with much more experience. I'm appreciative that I fell into the Perl rabbit hole.

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (9)
As of 2017-02-25 01:20 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (364 votes). Check out past polls.