
The external API is a perl module, which allows you to use various functions of bbBoard v2 in your own scripts. This is intended to help you integrate bbBoard v2 into your web site very simply.
For example, you may have a ``member's area'' on your web site. When someone registers for your member's area, you can have your perl script register their username on your message board at the same time - without them having to register twice.
The external API is very simple to integrate into your existing perl scripts. Here's the code needed to use it:
require 'bbv2api.pm';
my $bbv2 = new bbv2api;
# The below registers a new user on your message board
$bbv2->RegisterUser({ username => 'Username', password => 'password', email => 'some@example.com' });
# The below deletes a user from your board
$bbv2->DeleteUser('Username');
It's highly recommended that you check for errors returned from the methods of the API. All methods will return 0 if everything went OK. Otherwise, they will return an error message. Here's some sample error checking code:
require 'bbv2api.pm';
my $bbv2 = new bbv2api;
# register a user with username 'Bob', password 'betty' and e-mail address 'bob@example.com'
my $username = 'Bob';
my $password = 'betty';
my $email = 'bob@example.com';
my $result = $bbv2->RegisterUser({ username => $username, password => $password, email => $email });
if ($result != 0) {
die ``Got an error from bbv2api: $result'';
}
|