File: get_friend_page

package info (click to toggle)
libwww-myspace-perl 0.82-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 728 kB
  • ctags: 170
  • sloc: perl: 4,646; makefile: 10
file content (23 lines) | stat: -rwxr-xr-x 541 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/perl -w
# Return the page the passed friendID is on.
#
# usage: get_friend_page friendID

use WWW::Myspace;

my ( $friend_id ) = @ARGV;

unless ( ( defined $friend_id ) && ( $friend_id =~ /^[0-9]+$/ ) ) {
	die "usage: get_friend_page friendID\n";
}

my $myspace = new WWW::Myspace;
die "Login failed\n" unless $myspace->logged_in;

my $friends = $myspace->get_friends;

if ( exists $friends->{ $friend_id } ) {
	print $friends->{ $friend_id }->{'page_no'} . "\n";
} else {
	print "Friend $friend_id not found in friend list\n";
}