WWW::Myspace - Access MySpace.com from Perl scripts WWW::Myspace.pm provides methods to access myspace.com accounts and functions automatically. It provides a simple interface for scripts to log in, access lists of friends, scan user's profiles, retreive profile data, and post comments. Example: use WWW::Myspace; my $myspace = WWW::Myspace->new ($account, $password); OR my $myspace = new WWW::Myspace; # Prompts for email and password my ( @friends ) = $myspace->get_friends(); PREREQUESITES 'Spiffy' => 0.24, 'YAML' => 0.39, 'File::Spec::Functions' => 0, # Note: Forces File::Spec 0.7 or later. 'Contextual::Return' => 0, # For send_friend_request method 'Config::General' => 0, # FriendAdder.pm 'IO::Prompt' => 0, # For FriendAdder.pm 'List::Compare' => 0, # FriendAdder.pm 'Locale::SubCountry' => 0, # FriendAdder.pm, cool_new_people 'Math::Round' => 0, # FriendAdder.pm 'Params::Validate' => 0, # FriendAdder.pm 'Scalar::Util' => 0, # FriendAdder.pm 'Class::DBI' => 0, # Data.pm 'Class::DBI::Loader' => 0, # Data.pm 'WWW::Mechanize' => 0, Each of them has a list of dependencies also. If you don't have XML::Parser installed, you may need to manually install expat: http://sourceforge.net/projects/expat/ Just try installing and if the install fails look through the messages and see if it says you need expat. On MacOS X you'll need to install the developer tools from your Tiger install DVD or download them from http://developer.apple.com or nothing will install and you'll get errors about missing CORE files). (I haven't tested this on pre-Tiger MacOS, but it should work with those developer tools also). INSTALLATION Installing using the cpan command-line tool is the easiest as it will install the dependencies for you. cpan install WWW::Myspace or sudo cpan install WWW::Myspace Good general advice for installing any CPAN module: If a module fails to install: - Starting at the top, scan the copious output cpan will create - When you see a module has failed to install: - cd into the module's directory ( hint: cd ~/.cpan/build ; ls ) - Read the README for the module and install it manually. You'll see the specific errors it's having there. - Once it's installed, run your cpan install command again. If you don't configure cpan to use "sudo make install" (and you should, for which you'll need cpan 1.83), you'll probably want to run the cpan command as root or run "sudo cpan". man cpan for more info. To install this module manually, run the following commands: perl Makefile.PL make make test sudo make install # Or su root ; make install The distribution also installs the following convenience modules: WWW::Myspace::Comment WWW::Myspace::FriendChanges WWW::Myspace::Message WWW::Myspace::FriendAdder The distribution also installs the following handy scripts: add_friends approve_friends comment_myspace message_group These are scripts I use, and decided to include in the distribution in case they're handy, since they're the most common uses for the module, and they're a bit more robust and friendly than just using the methods in the module themselves. TEST SUITE WWW::Myspace accesses a web site, which by nature may change. Such change may break functions in this module. The test suite (run during cpan installation or when you type "make test") runs an extensive battery of tests on all methods against the myspace site. This has a few effects: 1) It makes sure the module works on your system. 2) It makes sure that the module works with the current version of the myspace site. 3) If the site changes, or has problems, tests may fail even though overall the module will work. My approach to programming is that the module should be robust enough to handle the changes in the myspace site, so if condition 3 occurs, the module needs beefing up. Note that you can re-run the test suite at any time. Keep a copy of the distribution (hint: cd ~/.cpan/build/WWW-Myspace* ) and run: perl Makefile.PL make test This is handy if you find that something in one of your scripts stops working and you're wondering if something changed that broke WWW::Myspace. If the tests pass, it's probably your script. If not, there'll probably be an update coming soon (make sure you have the latest version, of course - just re-run the cpan command). IMPORTANT NOTE ABOUT TESTS: As of version 0.40, you can run the full test suite against your own accounts. To do so, place a config file (copy/paste this and change the values) in ~/.www-myspace/test_config.yaml: --- acct1: friend_id: 12345 username: myspace_login_email_address password: myspace_login_password user_name: Username # (as it appears in "Hello, username" when you log in.) acct2: friend_id: username: password: user_name: test_group: 100009984 See t/config.yaml for an example file (but lacking "username" and "password"). This establishes test data for 2 accounts, "acct1", and "acct2". You provide the login info, friendID, and display name for each account. The test scripts then log into each account and test the module's methods using them. They'll post comments back and forth, send a message or two, and delete and add each other as friends. It should be safe to run on an active account, but if you feel nervous, set up a couple dummy accounts. NOTE THAT acct2 MUST BE A PERSONAL (not a band) ACCOUNT, or the is_band test will fail, causing your tests to fail. SUPPORT AND DOCUMENTATION After installing, you can find documentation for this module with the perldoc command. perldoc WWW::Myspace You can also look for information at: Search CPAN http://search.cpan.org/dist/WWW-Myspace CPAN Request Tracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-Myspace AnnoCPAN, annotated CPAN documentation: http://annocpan.org/dist/WWW-Myspace CPAN Ratings: http://cpanratings.perl.org/d/WWW-Myspace COPYRIGHT AND LICENCE This module copyright (C) 2005-2006 Grant Grueninger except FriendAdder.pm, (c) 2006 Olaf Alders. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.