Ignore:
Timestamp:
Oct 28, 2009, 11:13:05 PM (15 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.10, release-1.7, release-1.8, release-1.9
Children:
e4951ea
Parents:
d69c37c
git-author:
Nelson Elhage <nelhage@mit.edu> (10/06/09 23:11:25)
git-committer:
Nelson Elhage <nelhage@mit.edu> (10/28/09 23:13:05)
Message:
Weakrefs
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/BarnOwl/Module/Twitter/Handle.pm

    rd69c37c r7424a5b  
    1616use Net::Twitter::Lite;
    1717use HTML::Entities;
     18
     19use Scalar::Util qw(weaken);
    1820
    1921use BarnOwl;
     
    107109    my $delay = shift;
    108110
     111    my $weak = weaken($self);
     112
    109113    if($self->{cfg}->{poll_for_tweets}) {
    110114        $self->{timer} = BarnOwl::Timer->new({
    111115            after    => $delay,
    112116            interval => 60,
    113             cb       => sub { $self->poll_twitter }
     117            cb       => sub { $weak->poll_twitter if $weak }
    114118           });
    115119    }
     
    119123            after    => $delay,
    120124            interval => 120,
    121             cb       => sub { $self->poll_direct }
     125            cb       => sub { $weak->poll_direct if $weak }
    122126           });
    123127    }
Note: See TracChangeset for help on using the changeset viewer.