
Twitter::TagGrep - Find messages with selected tags in Twitter timelines

Version 1.00

use Twitter::TagGrep;
use Net::Twitter;
my $twit = Net::Twitter->new( ... );
my $tg = Twitter::TagGrep->new( prefix => '#!',
tags => [ 'foo', 'bar' ] );
my $timeline = $twit->friends_timeline;
# Get tweets containing one or more of #foo, #bar, !foo, or !bar
my @matches = $tg->grep_tags($timeline);
for my $tweet (@matches) {
print $tweet->{text}, "\n", join(', ', @{$tweet->{tags}}), "\n";
}

newInitializes and returns a new Twitter::TagGrep object.
Takes the following optional parameters:
prefixIf passed a parameter, replaces the set of recognized prefixes.
Returns the set of recognized prefixes as a single string value.
add_prefixAppends all parameters to the set of recognized prefixes and returns that set.
tagsIf passed one or more parameters, sets the list of recognized tags. Any array references will add the contents of the referenced array, while other parameters will be used as-is.
Returns an array of recognized tags.
add_tagAs tags, but appends to the list of tags rather than replacing it.
grep_tagsTakes a single scalar parameter referencing a Twitter timeline as returned by Net::Twitter's *_timeline functions.
Returns an array of tweets found within that timeline which contain at least one instance of (any character found in the prefix setting) followed by (any string listed in the tags setting). This check is case-insensitive.
A list of tags found in each returned tweet is added to it under the "tags" hash key.
The tag must normally stand alone as a word by itself, but can be matched as a substring by using regular expression metacharacters in tags values. Wildcard searches may also be done in this fashion, such as using the value "\w+" to locate all tweets containing one or more tags.

Dave Sherohman, <dave at sherohman.org>

Please report any bugs or feature requests to bug-twitter-taggrep at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Twitter-TagGrep. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

You can find documentation for this module with the perldoc command.
perldoc Twitter::TagGrep
The latest version of this module may be obtained from
git://sherohman.org/tag_grep
You can also look for information at:


Copyright 2009 Dave Sherohman, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.