Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

koschei (147)

koschei
  useperl@dellah.org
http://eh.org/~koschei/

Um. Me. Iain Truskett. Can be found as either Spoon or Koschei around the place, and as Braxiatel in rare circumstances. Um. Cool. Ta.

My perl svn repository [dellah.org] if you want bits of code by me. Also see dellah.org [dellah.org] for most of them in action.

My friends [perl.org], foes [perl.org], fans [perl.org], and freaks [perl.org]. And you can see what my friends are journalling [perl.org].

And everybody's journals [perl.org] (in order of updating).

Journal of koschei (147)

Sunday March 03, 2002
07:59 PM

useperl-journal-update

[ #3270 ]

Since russell asked:


[1003][iain@ouroboros]0% cat useperl-journal-update
#!/usr/local/bin/perl -w

use strict;
use Storable;
use Mail::Sendmail;
use WWW::UsePerl::Journal;
use IPC::Open2;

my $username = 'koschei';
my $j = WWW::UsePerl::Journal->new($username);
my @entries = $j->recentarray;
my $old = {};
$old = retrieve 'cache' if -f 'cache';

my $body;

foreach my $ent (reverse @entries)
{
        my $id = $ent->id.'-'.$ent->user;
        print "$id\n";
        next if exists $old->{$id};
        my ($user,$jid,$subject,$content) = ($ent->user, $ent->id, $ent->subject, $ent->content);

        my $child = 'lynx -stdin -dump';
        my($rdrfh, $wtrfh);
        my $pid = open2($rdrfh, $wtrfh, (split /\s/, $child));
        print $wtrfh $content;
        $wtrfh->close;
        my $fcontent = '';
        while ()
        {
                $fcontent .= $_;
        }
        $rdrfh->close;

        $body .= >> $subject

$fcontent

EOF
        $old->{$id} = time;
}

$old = {
        map { $_, time } ((sort { $old->{$a} $old->{$b} } keys %$old)[0..50])
};

store $old, 'cache';

my %mail =
(
        To => 'journals@dellah.anu.edu.au',
        From => 'journals@dellah.anu.edu.au',
        Subject => 'use.perl.org Journals',
        Body => $body,
);

my $status = sendmail(%mail);
warn $status;

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Naturally, in that sort nearish the bottom, $a and $b should be around the other way (or bung reverse in the appropriate position).
    --
      ---ict / Spoon