NAME |
Synopsis |
Description |
Distributions |
Constructor and initialization |
Method: parse($input_file_name) |
Method: parse($input_file_name) |
Method: unexpected() |
Required Modules |
Changes |
Author |
Copyright |
NAME
Synopsis#!/usr/bin/perl use strict; use warnings; use Data::Dumper; use Data::PABX::ParseLex; # ----------------------------------------------- sub process
{
my($parser, $input_file_name) = @_;
my($hash) = $parser -> parse($input_file_name);
print Data::Dumper -> Dump([$hash], ['PABX']); } # End of process. # ----------------------------------------------- $Data::Dumper::Indent = 1; my($parser) = Data::PABX::ParseLex -> new(); process($parser, 'pabx-a.txt'); process($parser, 'pabx-b.txt'); See examples/test-parse.pl for this test program, and the same directory for 2 test data files. The output is in examples/test-parse.log. Note: My real data has of course been replaced in these files with random numbers. Description
This module reads the output file from the 'lex a e' (List Extensions, All Extensions) command given to a PABX of type iSDC. It returns a hash ref keyed by extension. DistributionsThis module is available both as a Unix-style distro (*.tgz) and an ActiveState-style distro (*.ppd). The latter is shipped in a *.zip file. See http://savage.net.au/Perl-modules.html for details. See http://savage.net.au/Perl-modules/html/installing-a-module.html for help on unpacking and installing each type of distro. Constructor and initializationnew(...) returns an object of type This is the class's contructor. Usage: Data::PABX::ParseLex -> new(). This method takes no parameters. Method: parse($input_file_name)Returns: A hash ref of the data read from the file. The file is assumed to be the output of the 'lex a e' command issued to a PABX of type iSDC. The 'lex a e' command may have been run several times, and the output of all runs concatenated into the file. This module checks for multiple copies of the output, and discards all but the last. It does this by looking for the string /lex a e/i, and deleting all data from the start of the file down to the record containing this string. Typical lines in the input file look like: EN22433 EC141702 KSGM CS11 TA07 MOH 000 BE BI RE RI 54103 Ron S DN58903 BC0123 A04 D TP02 CS31 TA31 MOH 000 where '22433' and '58903' are the extensions. The other fields on the line are attributes of this extension. Fields are generated from such lines by splitting the lines on spaces, except for lines such as 'Ron S'. The line 'Ron S' needs a bit of an explanation. This field is known in this module as the KSGM id. You see, some lines don't contain extensions. They contain the names people choose to have appear on the caller's display. 'Ron S' is such an id. The KSGM id may be blank. The keys of the returned hash are the 4 or 5 digit extensions. Each of these keys points to another hash ref with the following keys (listed in alphabetical order):
Method:
|
| Top of page |