FTN::Addr - Object-oriented module for creation and work with the ftn addresses.
Version 20090704
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
FTN::Addr module for creation and work with the ftn addresses. Supports domains, different representations and comparison operators.
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.
Above presented all available forms.
Direct access to object fields.
No checking is performed.
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.
Valery Kalesnik, <valkoles at gmail.com>
<valkoles at gmail.com>
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.
bug-ftn-addr at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc FTN::Addr
To install FTN::Addr, copy and paste the appropriate command in to your terminal.
cpanm
cpanm FTN::Addr
CPAN shell
perl -MCPAN -e shell install FTN::Addr
For more information on module installation, please visit the detailed CPAN module installation guide.