App::Addex::Entry - an entry in your address book


App-Addex documentation Contained in the App-Addex distribution.

Index


Code Index:

NAME

Top

App::Addex::Entry - an entry in your address book

VERSION

Top

version 0.022

METHODS

Top

Achtung! The API to this code may very well change.

new

  my $entry = App::Addex::Entry->new(\%arg);

This method returns an Addex Entry object.

Valid parameters (sure to change) are:

  name   - a full name (required)
  nick   - a nickname (optional)
  emails - an arrayref of email addresses (required)

name

nick

These methods return the value of the property they name.

emails

This method returns the entry's email addresses. In scalar context it returns the number of addresses.

field

  my $value = $entry->field($name);

  $entry->field($name => $value);

This method is generated by Mixin::ExtraFields::Param.

AUTHOR

Top

Ricardo SIGNES, <rjbs@cpan.org>

BUGS

Top

Please report any bugs or feature requests through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

COPYRIGHT

Top


App-Addex documentation Contained in the App-Addex distribution.
#!/usr/bin/perl
use strict;
use warnings;

package App::Addex::Entry;

use Mixin::ExtraFields::Param -fields => {
  driver  => 'HashGuts',
  moniker => 'field',
  id      => undef,
};

use Carp ();

our $VERSION = '0.022';

sub new {
  my ($class, $arg) = @_;

  # XXX: do some validation -- rjbs, 2007-04-06
  my $self = {
    name   => $arg->{name},
    nick   => $arg->{nick},
    emails => $arg->{emails},
  };

  bless $self => $class;

  $self->field(%{ $arg->{fields} }) if $arg->{fields};

  return $self;
}

sub name { $_[0]->{name} }
sub nick { $_[0]->{nick} }

sub emails { @{ $_[0]->{emails} } }

1;