The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

FTN::Addr - Object-oriented module for creation and working with FTN addresses.

VERSION

version 20160303

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; # they actually are, because default domain is 'fidonet'

  $b -> set_domain( 'othernet' );

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

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

  $b = $a -> new( '44.22' ) or die "cannot create address"; # the same

  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 is for creation and working with FTN addresses. Supports domains, different representations and comparison operators.

OBJECT CREATION

new

Can be called as class or object method:

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

  $t = $t -> new( '1:22/33.44@fidonet' ) or die 'something wrong!'; # advisable to use class call here instead:
  $t = FTN::Addr -> new( '1:22/33.44@fidonet' ) or die 'something wrong!';

Default domain is 'fidonet'. If point isn't specified, it's considered to be 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
  The Brake! FTN-compatible mailer for OS/2 style  fidonet.1.23.45.0

If passed address misses any part except point and domain, the base is needed to get the missing information from (including domain). It can be optional second parameter (already created FTN::Addr object) in case of class method call or object itself in case of object method call.

  my $an = FTN::Addr -> new( '99', $t ); # class call.  address in $an is 1:22/99.0@fidonet
  $an = $t -> new( '99' );               # object call.  the same resulting address.

Performs field validation.

In case of error returns undef in scalar context or empty list in list context.

clone

  $th = $an -> clone

FIELD ACCESS

Direct access to object fields. Checking is performed (dies on error). Setters return itself (for possible chaining).

domain:

  $an -> set_domain( 'mynet' );
  $an -> domain;
  $an -> domain( 'leftnet' );

zone:

  $an -> set_zone( 2 );
  $an -> zone;
  $an -> zone( 3 );

net:

  $an -> set_net( 456 );
  $an -> net;
  $an -> net( 5020 );

node:

  $an -> set_node( 33 );
  $an -> node;
  $an -> node( 60 );

point:

  $an -> set_point( 6 );
  $an -> point;
  $an -> point( 0 );

REPRESENTATION

f4 - Full 4d address (without domain):

  print $an -> f4;   # 1:22/99.0

s4 - Short form (if possible) of 4d address:

  print $an -> s4;   # 1:22/99

f5 - Full 5d address (with domain):

  print $an -> f5;   # 1:22/99.0@fidonet

s5 - Short form (if possible - only for nodes) of 5d address:

  print $an -> s5;   # 1:22/99@fidonet

fqfa - Full qualified FTN address:

  print $an -> fqfa; # fidonet#1:22/99.0

bs - The Brake! FTN-compatible mailer for OS/2 style representation:

  print $an -> bs;   # fidonet.1.22.99.0

COMPARISON

equal, eq, cmp

Two addresses can be compared.

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

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

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

  print "the same address!\n" if $one eq $two;                   # the same result

  print "but objects are different\n" if $one != $two;           # should print the message

The same way (comparison rules) 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