Skip to content

Instantly share code, notes, and snippets.

@sharifulin
Created April 24, 2012 13:00
Show Gist options
  • Save sharifulin/2479453 to your computer and use it in GitHub Desktop.
Save sharifulin/2479453 to your computer and use it in GitHub Desktop.
!!
$list = [
grep {
my $what;
$what->{retweet} = !!$_->{retweeted_status};
$what->{reply } = !!$_->{in_reply_to_user_id_str};
$what->{tweet } = !$what->{retweet} && !$what->{reply};
warn qq(It's tweet "$what->{tweet}", reply "$what->{reply}", retweet "$what->{retweet}": $_->{text}\n);
my $yes;
if (grep { $task->{$_} } qw(only_tweet only_reply only_retweet)) {
$yes += $task->{only_tweet } && $what->{tweet } ? 1 : 0;
$yes += $task->{only_reply } && $what->{reply } ? 1 : 0;
$yes += $task->{only_retweet} && $what->{retweet} ? 1 : 0;
}
else {
$yes++;
}
$yes;
}
@$list
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment