I have been working on a distribution for CPAN that handles TL1 messages, as used in many types of telecom equipment.

I am hoping to get some feedback on the design of this distribution including constructive criticism on the quality of the code. I'm particularly interested in whether or not my fellow Monks find this code clear, understandable, and maintainable.

Unfortunately, neither the existing Net::TL1 CPAN module nor the Non-CPAN TL1 module fit my needs, so I've written this in hopes of producing something that will work with a broader set of devices, and perhaps useful to other engineers in my profession.

Because of the amount of code, I'm posting it in the first three replies to this node, one for each package.

If anyone wants to try it out, I've also written a simplistic TL1 'simulator' along with a demo that shows how to use this module. Run the simulator in one terminal window and the demo in another.

Demo client app:
#!/usr/bin/perl use TL1ng::Telnet; use Data::Dumper; $| = 1; # Autoflush STDOUT my $tl1 = new TL1ng::Telnet( timeout => 10, hostname => '127.0.0.1', port => 12345, connect => 0, # Don't auto-connect. ); $tl1->connect(); print "TL1 Connection opened\n" if $tl1->connected(); while($tl1->connected()) { while(my $msg = $tl1->get_next()){ print Dumper $msg; } }
TL1 server simulator:
#!/usr/bin/perl use IO::Socket; #$| = 1; my $sock = new IO::Socket::INET ( LocalHost => '127.0.0.1', LocalPort => '12345', Proto => 'tcp', Listen => 1, Reuse => 1, ) || die "Could not create socket: $!\n"; print "Socket created, listening for client connection...\n"; my $client = $sock->accept(); $client->autoflush(1); print "Client connected, sending data...\n\n"; print "\n"; while(<DATA>) { chomp; /^$/ ? print $client "$_\n" : print $client "$_\015\012"; while (<DATA>) { chomp; if (/^$/) { print $client "$_\n"; last } print $client "$_\015\012"; } # select can simulate sleeping for fractions of a second. my $yfact = int(rand() * 1000)/1000; my $xfact = int(rand() * 1000)/1000; my $sleep = int($xfact * $yfact * 100 - 10)/100; select(undef, undef, undef, abs $sleep); } print "All data sent. Quitting.\n\n"; __DATA__ ALBNYN51 2007-07-27 17:33:40 A 4164.4164 REPT EVT T1 "FAC-1-2:T-ESL,TC,,,FEND,,65,65,15-MIN:\"Performance Monitor Thresh +old Crossing Alert\"," ; LAWMAN01 2007-07-27 17:33:40 A 618.616 REPT ALM T1 "FAC-14-9:CL,AIS,NSA,,,,:\"Alarm Indication Signal\",DS1-14" ; BOSMAN51 2007-07-27 17:33:40 A 8964.8963 REPT ALM VT1 "VT1-6-1-29-1-1:CL,RFI-V,NSA,,,,:\"Remote Failure Indication - VT\" +,OC48" ; LAWMAN01 2007-07-27 17:33:40 ** 619.619 REPT ALM T1 "FAC-14-9:MJ,LOF,SA,,,,:\"Loss Of Frame\",DS1-14" ; BOSMAN51 2007-07-27 17:33:40 A 8965.8962 REPT ALM VT1 "VT1-6-1-29-3-2:CL,RFI-V,NSA,,,,:\"Remote Failure Indication - VT\" +,OC48" ; BANMEN01 2007-07-27 17:33:40 A 7623.7623 REPT EVT T1 "FAC-4-2:T-SEFS,TC,,,FEND,,25,25,15-MIN:\"Performance Monitor Thres +hold Crossing Alert\"," ; SYRNYN51 2007-07-27 17:33:42 A 6443.6443 REPT EVT T1 "FAC-1-8:T-ESL,TC,,,FEND,,65,65,15-MIN:\"Performance Monitor Thresh +old Crossing Alert\"," ; LAWMAN01 2007-07-27 17:33:43 A 620.619 REPT ALM T1 "FAC-14-9:CL,LOF,SA,,,,:\"Loss Of Frame\",DS1-14" ; LAWMAN01 2007-07-27 17:33:43 A 621.621 REPT EVT T1 "FAC-14-9:T-UASP,TC,,,FEND,,10,10,15-MIN:\"Performance Monitor Thre +shold Crossing Alert\"," ; LAWMAN01 2007-07-27 17:34:30 A 632.632 REPT EVT T1 "FAC-4-2:T-ESL,TC,,,FEND,,65,65,15-MIN:\"Performance Monitor Thresh +old Crossing Alert\"," ; LAWMAN01 2007-07-27 17:34:30 A 633.627 REPT ALM T1 "FAC-14-9:CL,RAI,NSA,,,,:\"Remote Alarm Indication\",DS1-14" ; bosman62 2007-07-27 18:00:54 A 6962.6960 REPT ALM VT1 "VT1-6-1-30-7-2:CL,RFI-V,NSA,,,,:\"Remote Failure Indication - VT\" +,OC48" ;


In reply to RFC: Looking for review of a set of modules for handling TL1 by Hercynium

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.