AddressBook

 view release on metacpan or  search on metacpan

lib/AddressBook.pm  view on Meta::CPAN

      $master->add($entry) || croak $master->code;;
    } else {croak "Error: entry matched multiple entries in master!\n"}
  }
  $msg = "Truncating slave\n";
  if ($args{debug}) {print $msg}
  if ($args{msg_function}) {&{$args{msg_function}}($msg)}
  $slave->truncate;
  $master->reset;
  $msg = "Adding master's records to slave\n";
  if ($args{debug}) {print $msg}
  if ($args{msg_function}) {&{$args{msg_function}}($msg)}
  while ($entry = $master->read) {
    $slave->write($entry);
  }
}

=head2 search

  $abook->search(attr=>\%filter);
  while ($entry=$abook->read) {
    print $entry->dump;
  }

\%filter is a list of cannonical attribute/value pairs. 

=cut

sub search {
  my $self = shift;
  my $class = ref $self || croak "Not a method call.";

  carp "Method not implemented."
}

=head2 read

  $entry=$abook->read;

Returns an AddressBook::Entry object

=cut

sub read {
  my $self = shift;
  my $class = ref $self || croak "Not a method call.";

  carp "Method not implemented"
}

=head2 update

  $abook->update(filter=>\%filter,entry=>$entry)

\%filter is a list of cannonical attriute/value pairs used to identify the entry to
be updated.

$entry is an AddressBook::Entry object

=cut

sub update {
  my $self = shift;
  my $class = ref $self || croak "Not a method call.";

  carp "Method not implemented"
}

=head2 add

  $abook->add($entry)

$entry is an AddressBook::Entry object

=cut

sub add {
  my $self = shift;
  my $class = ref $self || croak "Not a method call.";

  carp "Method not implemented"
}

=head2 delete

  $abook->delete($entry)

$entry is an AddressBook::Entry object

=cut

sub delete {
  my $self = shift;
  my $class = ref $self || croak "Not a method call.";

  carp "Method not implemented"
}

=head2 truncate

  $abook->truncate

Removes all records from the database.

=cut

sub truncate {
  my $self = shift;
  my $class = ref $self || croak "Not a method call.";

  carp "Method not implemented"
}

=head2 get_attribute_names 

  @names = $abook->get_attribute_names;

Returns a list of valid backend-specific attribute names

=cut

sub get_attribute_names {

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.019 second using v1.00-cache-2.02-grep-82fe00e-cpan-b63e86051f13 )