root/lang/perl/Net-Twitter-Friend-Finder/trunk/lib/Net/Twitter/Friend/Finder.pm @ 1194

Revision 1194, 1.8 kB (checked in by tomyhero, 6 years ago)

lang/perl/Net-Twitter-Friend-Finder: Add Net::Twitter::Friend::Finder::FromTwitter?

Line 
1package Net::Twitter::Friend::Finder;
2
3use strict;
4use warnings;
5use base qw/Class::Accessor::Fast/;
6use Net::Twitter;
7
8our $VERSION ='0.01_01';
9
10__PACKAGE__->mk_accessors(qw/limit ids username password on_echo/);
11
12sub search {
13    die 'please implement search method';
14}
15
16sub show {
17    my $self = shift;
18
19    my $t1 = Text::SimpleTable->new( 3, 20 );
20    $t1->row( '#', 'Twitter id');
21    print $t1->draw;
22   
23    my $t2 = Text::SimpleTable->new( '3', 20 );
24
25    my $cnt = 1;
26    for my $id ( @{ $self->{ids} } ) {
27        $t2->row( $cnt, $id );
28        $cnt++;
29    }
30
31    print $t2->draw;
32
33}
34
35sub follow {
36    my $self = shift;
37    my $twit = Net::Twitter->new( username=>$self->{username} ,password=> $self->{password});
38    foreach my $id (  @{ $self->{ids} } ) {
39        my $result = $twit->follow( $id );
40        print "follow $id \n" if $self->{on_echo};
41    }
42
43}
44
451;
46
47=head1 NAME
48
49Net::Twitter::Friend::Finder - Find Twiiter Frined
50
51=head1 DESCRIPTION
52
53IMPORTANT! Interface is under development. It will be change future. Planning
54to convert plaggable interface.
55
56This package is just template so that you should not use this directly , instead use it as base.
57
58=head1 METHOD
59
60=head2 new
61
62Twitter username, password is required as argument when you want to call follow method.
63
64on_echo , limit , lang is optional.
65
66 my $twitter = Net::Twitter::Friend::Finder::FromGoogle->new( { username => 'xxx' , password => 'xxx' , on_echo => 1, limit => 20 , lang => 'ja' } );
67
68=head2 search
69
70when you implement search you must set $self->{ids} valiable which contains list of twitter's id you want to follow.
71
72=head2 show
73
74display who you are going to follow.
75
76=head2 follow
77
78follow friends!!!!
79
80=head1 SEE ALSO
81
82L<Net::Twitter::Friend::Finder::FromGoogle>
83
84L<Net::Twitter::Friend::Finder::FromTwitter>
85
86sbin/sample.pl
87
88=head1 AUTHOR
89
90Tomohiro Teranishi <tomohiro.teranishi@gmail.com>
91
92=cut
Note: See TracBrowser for help on using the browser.