AddressBook
view release on metacpan or search on metacpan
lib/AddressBook.pm view on Meta::CPAN
eval qq{
require AddressBook::DB::$driverName;
\$self = AddressBook::DB::$driverName->new(dsn => "$dsn",
config => \$self->{config},
\%bedb_args,
);
};
croak "Couldn't load backend `$driverName': $@" if $@;
$self->{db_name}=$type;
} else {
bless ($self,$class);
}
return $self;
}
=head2 sync
AddressBook::sync(master=>$master_db, slave=>$slave_db)
AddressBook::sync(master=>$master_db, slave=>$slave_db,debug=>1)
Synchronizes the "master" and "slave" databases. The "master" database type must be
lib/AddressBook/Config.pm view on Meta::CPAN
$VERSION = '0.13';
$AddressBook::Config::config_file = "/etc/AddressBook.conf";
#----------------------------------------------------------------
sub new {
my $class=shift;
my %args = @_;
my $self = {};
bless ($self,$class);
my ($parser,$config,$field,$field_name,$attr,$db_type,$db_field_name,$db,$select,$option,$value);
$self->{config_file} = $args{config_file} || $AddressBook::Config::config_file;
eval {
$parser = XML::DOM::Parser->new(ErrorContext=>1,
ParseParamEnt=>1,
ProtocolEncoding=>'UTF-8');
$config = $parser->parsefile($self->{config_file});
};
if ($@ || ! $config) {
$self->configError("Error reading config file: $@");
lib/AddressBook/DB/DBI.pm view on Meta::CPAN
Like all AddressBook database constructor parameters, the "dsn" and "table" may
also be specified in the configuration file.
=back
=cut
sub new {
my $class = shift;
my $self = {};
bless ($self,$class);
my %args = @_;
foreach (keys %args) {
$self->{$_} = $args{$_};
}
if(defined $self->{dsn}) {
($self->{dbi_driver},$self->{dsn}) = split (':',$self->{dsn});
my $dbh = DBI->connect("dbi:" . $self->{dbi_driver} . ":" . $self->{dsn})
|| croak $self->{dbh}->errstr;
$self->{dbh} = $dbh;
}
lib/AddressBook/DB/HTML.pm view on Meta::CPAN
use vars qw($VERSION @ISA);
use CGI qw(:standard);
$VERSION = '0.14';
@ISA = qw(AddressBook);
sub new {
my $class = shift;
my $self = {};
bless ($self,$class);
my %args = @_;
foreach (keys %args) {
$self->{$_} = $args{$_};
}
unless ($self->{write_format}) {$self->{write_format} = 'table(Tr({-valign=>"TOP"},[map{td(["$_:",$attributes{$_}])} keys %attributes]))'}
unless ($self->{form_format}) {$self->{form_format} = 'table(Tr({-valign=>"TOP"},[map{td([$_,$attributes{$_}])} keys %attributes]))'}
unless ($self->{intra_attr_sep}) {$self->{intra_attr_sep} = '<br>'}
return $self;
}
lib/AddressBook/DB/LDAP.pm view on Meta::CPAN
base=>"o=test"
);
Any or all options may be specified in the constructor, or in the configuration file.
=cut
sub new {
my $class = shift;
my $self = {};
bless ($self,$class);
my %args = @_;
foreach (keys %args) {
$self->{$_} = $args{$_};
}
my ($hostname,$base,$mesg);
if ($self->{dsn}) {
($hostname,$base) = split "/", $self->{dsn};
}
$self->{hostname} = $hostname || $self->{hostname};
$self->{base} = $base || $self->{base};
lib/AddressBook/DB/LDIF.pm view on Meta::CPAN
$a = AddressBook->new(source => "LDIF",
filename => "/tmp/ldif")
The filename may also be specified in the configuration file.
=cut
sub new {
my $class = shift;
my $self = {};
bless ($self,$class);
my %args = @_;
foreach (keys %args) {
$self->{$_} = $args{$_};
}
$self->{mode} = "";
if (defined $self->{filename}) {
$self->{fh} = IO::File->new($self->{filename},O_RDWR | O_CREAT)
|| croak "Couldn't open `" . $self->{filename} . "': $@";
$self->{ldif} = Net::LDAP::LDIF->new($self->{fh});
}
lib/AddressBook/DB/PDB.pm view on Meta::CPAN
If a "pdb" parameter is supplied, it will be used as a reference to an already
created PDA::Pilot::DLP::DBPtr object. Otherwise, if a "port" is supplied,
the user will be prompted to press the hotsync button to establish the connection.
=cut
sub new {
my $class = shift;
my $self = {};
bless ($self,$class);
my %args = @_;
foreach (keys %args) {
$self->{$_} = $args{$_};
}
if (! $self->{pdb}) {
if (! $self->{dlp}) {
my $socket = PDA::Pilot::openPort($self->{port});
print "Now press the HotSync button\n";
$self->{dlp} = PDA::Pilot::accept($socket);
}
lib/AddressBook/DB/Text.pm view on Meta::CPAN
$a = AddressBook->new(source => "Text",filename => "/tmp/abook.text");
If no filename parameter is specified in the constructor, or in the configuration
file, STDOUT is used.
=cut
sub new {
my $class = shift;
my $self = {};
bless ($self,$class);
my %args = @_;
foreach (keys %args) {
$self->{$_} = $args{$_};
}
if (defined $self->{filename}) {
$self->{fh} = IO::File->new($self->{filename},O_RDWR | O_CREAT)
|| croak "Couldn't open `" . $self->{filename} . "': $@";
} else {
$self->{fh} = *STDOUT;
}
lib/AddressBook/Entry.pm view on Meta::CPAN
Can be used to specify that the keys of %attr are those for a specific backend.
=back
=cut
sub new {
my $class = shift;
my $self = {};
bless ($self,$class);
my %args = @_;
if ($args{config}) {
$self->{config} = $args{config};
} else {
$self->{config} = AddressBook::Config->new(config_file=>$args{config_file});
}
if ($args{attr}) {
$self->add(attr=>$args{attr},db=>$args{db});
}
return $self;
( run in 0.485 second using v1.01-cache-2.11-cpan-de7293f3b23 )