App::Addex::Entry::EmailAddress - an address book entry's email address


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

Index


Code Index:

NAME

Top

App::Addex::Entry::EmailAddress - an address book entry's email address

VERSION

Top

version 0.022

SYNOPSIS

Top

An App::Addex::Entry::EmailAddress object represents, well, an addess for an entry.

METHODS

Top

new

  my $address = App::Addex::Entry::EmailAddress->new("dude@example.aero");

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

Valid arguments are:

  address - the contact's email address
  label   - the label for this contact (home, work, etc)
            there is no guarantee that labels are defined or unique

  sends    - if true, this address may send mail; default: true
  receives - if true, this address may receive mail; default: true

address

This method returns the email address as a string.

label

This method returns the address label, if any.

sends

receives

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::EmailAddress;

our $VERSION = '0.022';

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

  $arg = { address => $arg } if not ref $arg;
  undef $arg->{label} if defined $arg->{label} and not length $arg->{label};

  for (qw(sends receives)) {
    $arg->{$_} = 1 unless exists $arg->{$_};
  }

  bless $arg => $class;
}

use overload '""' => 'address';

sub address {
  $_[0]->{address}
}

sub label {
  $_[0]->{label}
}

sub sends    { $_[0]->{sends} }
sub receives { $_[0]->{receives} }

1;