You don't need to spawn a background process for that. In my own IRC bot based on Bot::BasicBot I use the tick method to periodically check the svn repository.

Nothing spectacular, but it seems to work:

#!/usr/bin/perl use strict; use warnings; package SVNBot; use base 'Bot::BasicBot'; use SVN::Log; use Tie::File; my $repo_url = "file:///parrot/trunk/languages/perl6"; tie my @last_rev, 'Tie::File', 'last_revision' or die "Can't tie file last_revision: $!"; sub tick { my $self = shift; # warn "Rertrieving from r$last_rev[0]"; my $revs = SVN::Log::retrieve( $repo_url, $last_rev[0], 'HEAD', ); # the first revision was already printed in the last run splice @$revs, 0, 1; if (scalar @$revs > 5){ splice @$revs, 0, 5 - scalar(@$revs); } for my $r (@$revs){ my ($rn, $author, $msg) = ($r->{revision}, $r->{author}, $r->{message}); # no warnings 'uninitialized'; if (length $msg == 0){ $self->say( channel => '#perl6', body => "r$rn | $author | [no commit message]\n +", ); print "r$rn | $author | [no commit message]\n", } else { for (split /\n/, $msg){ $self->say( channel => '#perl6', body => "r$rn | $author++ | $_\n", ); print "r$rn | $author++ | $_\n", } } $last_rev[0] = $rn; } return 20; } package main; my $bot = SVNBot->new( server => 'irc.freenode.org', channels => ['#perl6'], nick => 'rakudo_svn', alt_nicks => ['rakudosvn', 'rakudo_svn2'], username => 'SVNBot', name => 'pugs SVN bot', charset => 'utf-8', ); $bot->run(); # vim: sw=4 ts=4 expandtab

In reply to Re: Bot::BasicBot forkit - help needed by moritz
in thread Bot::BasicBot forkit - help needed by rpetre

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.