Slash Boxes
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)


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 [] if you want bits of code by me. Also see [] for most of them in action.

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

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

Journal of koschei (147)

Sunday March 03, 2002
07:59 PM


[ #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;
        my $fcontent = '';
        while ()
                $fcontent .= $_;

        $body .= >> $subject


        $old->{$id} = time;

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

store $old, 'cache';

my %mail =
        To => '',
        From => '',
        Subject => ' 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.
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