Alex White (wu) > BBDB-Export-0.015 > BBDB::Export

Download:
BBDB-Export-0.015.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.015   Source  

NAME ^

BBDB::Export - export data from The Insidious Big Brother Database.

VERSION ^

version 0.015

SYNOPSIS ^

  use BBDB::Export;

  # export to LDIF
  my $exporter = BBDB::Export::LDIF->new(
                                         {
                                          bbdb_file   => "/path/to/.bbdb",
                                          output_file => "export.ldif",
                                          dc          => "dc=geekfarm, dc=org",
                                         }
                                          );
  $exporter->export();

  # sync with ldap via ldapadd and ldapdelete
  my $exporter = BBDB::Export::LDAP->new(
                                         {
                                          bbdb_file   => "/path/to/.bbdb",
                                          output_file => "/tmp/tempfile",
                                          dc          => "dc=geekfarm, dc=org",
                                          ldappass    => "supersecret",
                                         }
                                          );

  $exporter->export();

  # export to vcards
  my $exporter = BBDB::Export::vCard->new(
                                          {
                                           bbdb_file   => "/path/to/.bbdb",
                                           output_dir  => "/some/path/",
                                          }
                                           );

  $exporter->export();

  # create .mail_aliases
  my $exporter = BBDB::Export::MailAliases->new(
                                                {
                                                 bbdb_file   => "/path/to/.bbdb",
                                                 output_file => ".mail_aliases",
                                                }
                                                 );

  $exporter->export();

DESCRIPTION ^

This module was designed to export to your bbdb data to a wide array of formats, and also to make it easy to write new modules to export to new formats. Current export options include building an LDIF, vCard, or .mail_aliases, and automatically updating an ldap server.

For a fully functional command line converter, see the bbdb-export script that comes with this module.

BBDB::Export should not be used directly. Use any of the available subclasses using the examples above. For more examples of using BBDB::Export, see the test cases.

EXTENDING ^

When writing a new class, you can define the following subroutines:

get_record_hash

given a record hash, create or modify any keys and values that are needed to export your data. If the fields already provided are sufficient, you don't need to define this method. If you do define this method, you'll need to call this method from the superclass first, e.g.

    my ( $self, $record ) = @_;
    $record = $self->SUPER::get_record_hash( $record );
process_record

given a record hash, generate exported data. Also perform any per-record actions. For example, if you are creating one export file per record, write the current record to a file in this method.

post_processing

run any processing that needs to be done after all records have been processed. For example, if you are creating one file containing all records, write the file in this method.

SUBROUTINES/METHODS ^

new
export
run_command

run an external command, e.g. ldapadd

$obj->info( @lines )

report informational messages to the user.

$obj->error( @lines )

report error messages to the user.

$obj->verbose( @lines )

report debugging info to user. this information will only be displayed if verbose output is enabled.

SEE ALSO ^

- bbdb - an emacs mode for managing information about contacts

- BBDB - perl module for parsing bbdb data files.

- OpenLDAP - open source ldap implementation

- http://www.onlamp.com/pub/a/onlamp/2003/03/27/ldap_ab.html - how to set up ldap.

- http://www.geekfarm.org - bbdb2ldap.

- PlannerMode - also on geekfarm. A module for exporting emacs todo lists and schedule info to other clients including palm.

AUTHOR ^

 wu <VVu@geekfarm.org>

COPYRIGHT AND LICENSE ^

Copyright (c) 2005, VVu@geekfarm.org All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

- Neither the name of the geekfarm.org nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

syntax highlighting: