ERROR:PID=21295 03:01:22 Input: JFK NEW YORK NY25MYUS
PID=21295 03:01:22 Reply:
PID=21296 03:01:25 Input: JFK NEW YORK
####
EROOR2:Mapping is not found.::
PID=21295 03:01:22 Mapping isn't in the TxnList
PID=21296 03:01:25 Mapping isn't in the TxnList
PID=21288 03:31:33 --- end session ---
####
<
?)
before HiltonTxn?)
Number found where operator expected at Adhoc.txn line 104, near "9404 20"
found where operator expected at Adhoc.txn line 105, near "Y"
s>Y"
(Missing operator before Y?)
Bareword found where operator expected at Adhoc.txn line 113, near "/IncludeProps>US
####
# format the prop so we don't have to do that later
$prop->AddrLine1( $prop->FormatFirstCharUpper( $prop->AddrLine1() ));
$prop->City( $prop->FormatFirstCharUpper( $prop->City() ) );
$prop->PostalCd( uc( $prop->PostalCd() ));
# $prop->Country( $addr->LookupCountryName( $prop->CountryCd()) );
# add the prop to the list
push @$props, $prop;
$prop_hash->{lc($prop->PropCd())} = $prop;
$prop_hash->{lc($prop->CityHocn())} = $prop;
my $s_name =
join( ' ', uniq( sort( split( /\s+/, lc( $prop->PropName())))));
my $str = lc( $prop->PropCd() . "|" .
$prop->CityHocn() . "| $s_name " );
push @$prop_text, $str;
# create a new prop db object and load it
$prop = hilton::adhoc::txn::Prop->New();
}
# close the file now that we've read it in
close FP;
# put it in context so we have it available everywhere
Context::SetAndLock( 'PropList', $props );
# also store the hash
Context::SetAndLock( 'PropHash', $prop_hash );
# and store the prop_text
Context::SetAndLock( 'PropText', $prop_text );
Debug::Print( 'loaded ' . scalar( @$props ) . ' props' );
}
=item LoadStates()
The state data is now stored in a States.ini file.
input:
nothing
return:
nothing
Note: Uses the States.ini module
=cut
sub LoadStates {
Debug::Print( "LoadStates" );
my $states = States::GetStateList();
if( !$states ) {
Logging::Die( "Unable to get the states data" );
}
Debug::Print( "States list: " . Dumper( $states ));
}
=item LoadCountries()
We now store the country data in the Countries.ini file so we don't need to
parse it.
input:
nothing
return:
nothing
Note: uses the Countries module
=cut
sub LoadCountries {
my $country_names = Countries::GetCountryNames();
my $country_list = Countries::GetCountryList();
if( !$country_names or !$country_list ) {
Logging::Die( "Unable to load the country list" );
}
# dump it.. this might be a little big
Debug::Print( "CountryList " . Dumper( $country_list ));
Debug::Print( "CountryNames " . Dumper( $country_names ));
}
=item LoadAirports()
Loads airport data from a file.
input:
nothing
return:
nothing
Note: Uses the AirportDataFile context value
=cut
sub LoadAdhocAirports {
my $fname = Context::Get( 'AirportDataFile' );
my $air_exclude = hilton::adhoc::utils::Airports::GetAirportExcludes();
Debug::Print( "AirEx: " . Dumper( $air_exclude ));
Context::SetAndLock( 'AirExclude', $air_exclude );
return 0;
# for speed
my @air_ex = keys %$air_exclude;
# make the pattern we're matching on
my $air_match = join ')|(', map quotemeta, @air_ex;
Debug::Print( "air_ex pattern: '$air_match'" );
Context::SetAndLock( "AirMatch", $air_match );
# verify the file exists
if( ! -e $fname ) {
Logging::Print( "LoadAirports: Unable to find $fname" );
exit -1;
}
# open the file for reading
open FP, "<$fname" or die "LoadAirports: Can't open $fname, $!";
# we're going to build up a list of airports
my $airports = [];
my $airport_hash = ();
# read the file line by line
while( ) {
# strip the newline character
chomp;
# skip blank lines and lines starting with '#'
next if !$_ || substr( $_, 0, 1 ) eq '#';
Debug::Print( "adding airport to list: $_" );
# WAS: my ($name, $ctry, $lat, $long, $cd, $rank ) = split( /\|/, $_ );
my ($cd, $name, $ctry, $lat, $long, $buf ) = split( /\|/, $_ );
my $rec = { AirportCd => uc($cd), Name => $name, CountryCd => $ctry,
Lat => $lat, Long => $long, Buf => $buf };
# add the airport to the list
push @$airports, $rec;
$airport_hash->{lc($cd)} = $rec;
$airport_hash->{lc($name)} = $rec;
# name the name be the airport code name
my $name2 = lc( "$cd - $name, $ctry " );
# we need to remote the word 'airport'
$name2 =~ s/airport//g;
# and change international to int'l
$name2 =~ s/international/int'l/g;
$name2 =~ s/[ ,-]//g;
$airport_hash->{$name2} = $rec;
# now break the terms out and store each (BUT not the excluded words)
my @terms = split( /[\s+-,!.]/, lc($name) );
foreach my $w (@terms) {
my $store = 0;
if( length( $w ) < 3 ) {
next;
}
if( !($w =~ m/($air_match)/) ) {
$airport_hash->{$w} = $rec;
}
}
}
# close the file now that we've read it in
close FP;
# put it in context so we have it available everywhere
Context::SetAndLock( 'AirportList', $airports );
Context::SetAndLock( 'AirportHash', $airport_hash );
Debug::Print( 'loaded ' . scalar( @$airports ) . ' airports' );
# Debug::Print( "Airport hash = " . Dumper( $airport_hash ));
}
=item LoadSpell()
Loads the stop words from the Lingua::StopWords system and then the spelling
dictionary
29Jun09 - also load the Spelling.ini words.
input:
nothing
return:
-1 on failure
=cut
use Lingua::StopWords qw ( getStopWords );
sub LoadSpell {
Debug::Print( "LoadSpell" );
Debug::Print( "Loading Spelling" );
my $spelling_list = Spelling::GetHash();
Debug::Print( "SpellingList = " . Dumper( \$spelling_list ));
Context::SetAndLock( "SpellingList", $spelling_list );
my $en = getStopWords( 'en', 'UTF-8' );
my $de = getStopWords( 'de', 'UTF-8' );
# build the hash
my %_stop_words = ( %$en, %$de );
my $stop_words = \%_stop_words;
Context::SetAndLock( "StopWords", $stop_words );
return 0;
}
1;