Dave Sherohman > Twitter-TagGrep > Twitter::TagGrep

Download:
Twitter-TagGrep-1.0000.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 1.0000   Source  

NAME ^

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

VERSION ^

Version 1.00

SYNOPSIS ^

    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";
    }

METHODS ^

new

Initializes and returns a new Twitter::TagGrep object.

Takes the following optional parameters:

prefix

A string defining the set of tag prefixes to recognize. Defaults to '#' (hashtags) if not specified.

tags

Either a single tag to search for or a reference to an array containing any number of tags to search for.

prefix

If passed a parameter, replaces the set of recognized prefixes.

Returns the set of recognized prefixes as a single string value.

add_prefix

Appends all parameters to the set of recognized prefixes and returns that set.

tags

If 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_tag

As tags, but appends to the list of tags rather than replacing it.

grep_tags

Takes 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.

AUTHOR ^

Dave Sherohman, <dave at sherohman.org>

BUGS ^

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.

SUPPORT ^

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:

ACKNOWLEDGEMENTS ^

COPYRIGHT & LICENSE ^

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.

syntax highlighting: