The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

This package implements the sending and collection of TL1 messages to and from a Telnet (or telnet-like) connection via use of Net::Telnet. Technically, it 'inherits' from TL1ng::Source. If Perl supported proper OO interfaces, that would mean it implements methods _read_msg() and _send_cmd() and timeout() (it does, as should any class 'implementing' TL1ng::Source)

Any other methods are specific to the particular type of 'Source'. Therefore, a calling script or a device-specific subclass of TL1ng that may use them should always check the isa() and/or the can() of $tll->source() before-hand.

new

Initalizes the object used to manage the telnet connection to a TL1 NE/GNE.

TODO: Add info on the valid parameters.

_read_msg

Reads a TL1 message from the connection to the NE and returns it as a multi-line string.

 my $msg = $tl1->_read_msg();

connect

Connects to the TL1 port using Telnet. The settings for the session are usually set when creating the object (via new). Dies if the connection fails.<BR> <BR> I may change this method drastically in the future.

connected

Use this to determine if the module is still connected to the TL1 data source.

 my $status = $tl1->connected();

disconnect

Close the connection to the TL1 data source. Always returns 1.

 $tl1->disconnect();

timeout

Use this to set or get the amount of time this module will wait for input from the Telnet connection. See documentation on timeout() for the Net::Telnet module on CPAN for more info on valid values. When getting (no parameter passed), returns the current timeout value. When setting, returns $self.

 # Get value
 my $timeout = $tl1->timeout();
 # Set value (returns $tl1, for chaining)
 $tl1->timeout($timeout);
 

DESTROY

Some TL1 NE/GNE devices *really* don't like it when the connection isn't properly terminated. Therefore, the destructor helps prevent that from happening by calling disconnect().

hostname

Sets or gets the hostname or IP address to connect to with Net::Telnet.

port

Sets or gets the TCP port to connect to with Net::Telnet.