[DFW.pm] IRC bots in Perl tomorrow!

Tommy Butler dfwpm at internetalias.net
Thu Nov 14 16:53:42 PST 2013


That's extremely strange behavior.

If I were you I'd try the following:

    use List::Util qw( shuffle );

    my $p = ( shuffle @phrases )[0];


You could also try a workaround such as the line below, just to see what
happens, but I would prefer the above.

    my $i = eval 'int( rand( scalar @nodes ) )';


--Tommy Butler

On 11/14/2013 06:09 PM, John Dexter wrote:
> So, I've been a long time lurker on the DFW.pm mailing list and
> decided to go ahead and get active by attending last night's meeting.
>  Of course, at the last minute I got saddled with an emergency
> database restore for work, so I was unable to attend.
>
> I did want to join in on the IRC bot fun, so I whipped up a little
> plugin of my own, that I call "Discuss".  Hate sitting in a dead IRC
> channel?  This will let you ask the bot for discussion topics based on
> blog posts at blogs.perl.org <http://blogs.perl.org>.
>
> I'm running into an issue though.  I'm using the rand() function to
> let the bot pick random posts and random return phrases, but it
> doesn't seem to be changing after the initial request.  My guess is
> that this is an issue with POE and the rand numbers are only generated
> once at compile time, so subsequent calls to the subroutine do not
> produce different results.  Anyone know how to get around that?  Or if
> that is even the issue?
>
> https://github.com/PsyDefect/dfwbot/blob/master/DFWpm/BotPlugin/Discuss.pm
>
> Sincerely,
>
> John Dexter
>
>
> On Tue, Nov 12, 2013 at 7:29 PM, Coyo <coyo at darkdna.net
> <mailto:coyo at darkdna.net>> wrote:
>
>     I can't believe it's my birthday already.
>
>     I feel so oooooooooooooold.
>
>     My birthday is tomorrow, the 13th. A hump day.
>
>     I hope that's an omen.
>
>
>
>     On 11/12/2013 04:42 PM, John Fields wrote:
>>
>>     2nd Wed is huuuummmpppddaaaayyy. :)
>>
>>     We will be running some home made bots and covering different
>>     ways to run them under Linux.  Maybe add a stats page, or a
>>     tabulated log of results?  Bring your ideas and "what ifs".
>>
>>     As usual it is at the dallasmakerspace.org
>>     <http://dallasmakerspace.org> at 7pm.  Some food afterwards at a
>>     local eatery.
>>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/dfw-pm/attachments/20131114/cbfc7c79/attachment.html>


More information about the Dfw-pm mailing list