NAME

FTN::Addr - Object-oriented module for creation and work with the ftn addresses.

VERSION

Version 20090704

SYNOPSIS

use FTN::Addr;

my $a = FTN::Addr -> new('1:23/45') or die "this is not a correct address";

my $b = FTN::Addr -> new('1:23/45@fidonet') or die 'cannot create address';

print "Hey! They are the same!\n" if $a eq $b; # should print, because default domain is 'fidonet'

$b -> set_domain('othernet');

print "Hey! They are the same!\n" if $a eq $b; # no output. we changed domain

$b -> new('44.22', $a) or die "cannot create address"; # takes the rest of information from optional $a

print $a -> f4 . "\n"; # 1:23/45.0

print $a -> s4 . "\n"; # 1:23/45

print $a -> f5 . "\n"; # 1:23/45.0@fidonet

print $a -> s5 . "\n"; # 1:23/45@fidonet

DESCRIPTION

FTN::Addr module for creation and work with the ftn addresses. Supports domains, different representations and comparison operators.

OBJECT CREATION

new

Can be called as class or instance method:

my $t = FTN::Addr -> new('1:23/45') or die 'something wrong!';

$t -> new('1:22/33.44@fidonet') or die 'something wrong!';

Default domain is 'fidonet'. If point isn't specified, it's taken as 0. Address can be:

3d/4d       (1:23/45 or 1:23/45.0)
5d          (1:23/45@fidonet or 1:23/45.0@fidonet)
fqfa        (fidonet#1:23/45.0)
brake style (fidonet.1.23.45.0)

Can have optional second parameter, which is an already created FTN::Addr object. If first parameter doesn't have some fields, they'll be fetched from second parameter.

my $an = FTN::Addr -> new('99', $t); # address in $an is 1:22/99.0@fidonet

Performs some checking of field correctness.

REPRESENTATION

Above presented all available forms.

FIELD ACCESS

Direct access to object fields.

$an -> set_domain('mynet');

$an -> domain;

$an -> set_zone(2);

$an -> zone;

$an -> set_net(456);

$an -> net;

$an -> set_node(33);

$an -> node;

$an -> set_point(6);

$an -> point;

No checking is performed.

COMPARISON

equal, eq, cmp

Two addresses could be compared. Domain is case-insensetive.

my $first = FTN::Addr -> new('1:23/45.66@fidonet') or die "cannot create";

my $second = FTN::Addr -> new('1:23/45.66@FidoNet') or die "cannot create";

print "the same address!\n" if FTN::Addr -> equal($first, $second); # should print

print "the same address!\n" if $first eq $second;                   # the same result

print "but objects are different\n" if $first != $second;           # should print

The same way as 'eq' works 'cmp' operator.

AUTHOR

Valery Kalesnik, <valkoles at gmail.com>

BUGS

Please report any bugs or feature requests to bug-ftn-addr at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=FTN-Addr. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc FTN::Addr