tie %options, 'Tie::IxHash', (
'company_name' => { label => 'Company name for header record',
- type => 'text'
+ type => 'text',
},
'company_id' => { label => 'NENA company ID',
type => 'text',
);
sub immediate {
- local $@;
- eval "use Geo::StreetAddress::US";
- if ($@) {
- if ($@ =~ /^Can't locate/) {
- return "Geo::StreetAddress::US must be installed to use the NENA2 export.";
- } else {
- die $@;
- }
- }
# validate some things
my ($self, $action, $svc) = @_;
}
sub data {
+ local $@;
+ eval "use Geo::StreetAddress::US";
+ if ($@) {
+ if ($@ =~ /^Can't locate/) {
+ return "Geo::StreetAddress::US must be installed to use the NENA2 export.";
+ } else {
+ die $@;
+ }
+ }
# generate the entire record here. reconciliation of multiple updates to
# the same service can be done at process time.
my $self = shift;
my %hash = map { $_ => '' } @{ $item_format->names };
$hash{function_code} = $function_code{$action};
-
+
# Add default area code if phonenum is 7 digits
- if ($self->option('area_code') =~ /^\d{3}/ && $svc->phonenum =~ /^\d{7}/ ){
- $svc->phonenum = $self->option('area_code'). $svc->phonenum
+ my $phonenum = $svc->phonenum;
+ if ($self->option('area_code') =~ /^\d{3}$/ && $phonenum =~ /^\d{7}$/ ){
+ $phonenum = $self->option('area_code'). $svc->phonenum;
}
# phone number
-
- $svc->phonenum =~ /^(\d{3})(\d*)$/;
+ $phonenum =~ /^(\d{3})(\d*)$/;
$hash{npa} = $1;
$hash{calling_number} = $2;
} else {
$hash{location} = $cust_location->address2;
}
- $hash{location} = $location_hash->{address2};
# customer name and class
$hash{customer_name} = $svc->phone_name_or_cust;