NAME
Net::Social::Service - the base package for all the Net::Social plugins
METHODS
my $service = Net::Social->service('LiveJournal');
or
my $service = Net::Social::Service::LiveJournal->new;
Get the params needed
my %params = Net::Social::Service::LiveJournal->params;
or my %params = $service->params;
for my $what (qw(read write)) {
print "Can $what\n" if $params{$what};
}
# list what keys are needed to login
foreach my $key (keys %$params{read}) {
print "$key: ".$params{read}->{$key}."\n";
}
then
$service->login(%params);
foreach my $friend ($service->friends) {
print "$friend->{name} $friend->{type}\n";
}
$service->add_friend("frank");
$service->remove_friend("frank");
new
Create a new Service
params
What fields are needed to log in to this service.
This will return a hash ref, the keys of which will be either read
or write
or one of each. If you log in using the write
params you will also be able to read.
Each of those will, in turn, be a hash ref the keys of which described what is needed. In turn their values will be another hash ref which can contain the fields
- description.
-
Always present. A description of the field.
- required
-
Defaults to 0. Dictates whether this field is required or optional.
- sensitive
-
Defaults to 0. Whether or not this field is sensitive or not.
By sensitive we mean that it compromises the user's account. Examples of this might be, say, a password as opposed to a authorisation token.
This is a bit of a judgment call, to be honest.
login <params>
Login in to this site.
friends
All your friends on the site.
The friends will be return as a list of hash refs.
The hash refs will contain various fields depending on the service returning the data such as name
(the person's full name), uid
(the uid on the service), username
(a username on the service, may be the same as uid). However each one will definitely contain type
which will be one of 4 values, defined as constants in Net::Social
.
- NONE
-
There's no defined relationship between the two of you.
- FRIENDED
-
You've friended them but they haven't friended you.
- FRIENDED_BY
-
They've friended you but you haven't friended them.
- MUTUAL
-
You've both friended each other.
MUTUAL
is defined asMUTUAL = FRIENDED | FRIENDED_BY
In the future I may make all services return a key
field or similar which will be the field needed for adding or deleting.
add_friend <username>
Add a friend.
remove_friend <username>
Remove a friend.
3 POD Errors
The following errors were encountered while parsing the POD:
- Around line 100:
You forgot a '=back' before '=head2'
- Around line 134:
Unknown directive: =over4
- Around line 136:
'=item' outside of any '=over'