TL1ng - A simple, flexible, OO way to work with TL1.
To get started, if you want *basic* no-frills TL1 functionality over Telnet:
use TL1ng; my $tl1_obj = TL1ng->new();
Which, currently, is the same as:
use TL1ng; my $tl1_obj = TL1ng->new({ Source => 'Telnet' Type => 'Base', });
And that produces an object of the type TL1ng::Base, configured to communicate with the NE/GNE via Telnet by use of the TL1ng::Source::Telnet module.
But that's just the default right now. This is even better, and may become the default in later versions:
use TL1ng; my $tl1_obj = TL1ng->new({ Type => 'Generic', });
That produces an object of the type TL1ng::Generic, (which is a subclass of TL1ng::Base,) also configured to communicate with the NE/GNE via Telnet (again, by use of the TL1ng::Source::Telnet module.)
TL1ng::Generic has methods for login, logout, and managing multiple sessions through a single 'source' conection, and once I've vetted it's functionality against a wider variety of equipment it will probably be merged with TL1ng::Base.
Coming soon will also be sub-classes to provide device or vendor-specicic TL1 functionality.
BTW, I see nothing wrong with simply use-ing and instantiating your desired sub-class module directly...
use
use TL1ng::Generic; my $tl1_obj = TL1ng::Generic->new({ Various => Params, Go => Here });
Perhaps the factory idea behind this module is bird-brained and the example above is better. I'm not sure, but welcome suggestions! As always, TMTOWTDI.
The module TL1ng is just a factory for getting instances of TL1ng::Base and it's sub-classes. The best way to learn about how this all works right now is to read the perldoc for TL1ng::Base, then read the perldoc for any specific sub-class(es) you may be using.
Returns an object of the type TL1ng::Base, or some sub-class. The only parameter this method truly cares about is Type, and it's value is used to determine which class to instantiate.
Type
All additional parameters are passed through to the new method of the instantiated class.
new
For example, Type => Foo will cause the module to load and create an object from TL1ng::Foo. All additional parameters are passed to TL1ng::Foo->new(). It's simplistic, and I already see the limitations, but it works for my needs and I simply don't have the time to do it a better way right now.
Type => Foo
TL1ng::Foo->new()
None by default.
Net::TL1 Net::Telnet
Steve Scaffidi, <mailto:sscaffidi@cpan.net|sscaffidi@cpan.net>
Copyright (C) 2007 by Steve Scaffidi
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
To install TL1ng, copy and paste the appropriate command in to your terminal.
cpanm
cpanm TL1ng
CPAN shell
perl -MCPAN -e shell install TL1ng
For more information on module installation, please visit the detailed CPAN module installation guide.