NAME
Finance::DST::FAN::Mail::Utils - Utilities for interacting with DST FANMail Files
SYNOPSIS
use Finance::DST::FAN::Mail::File::Utils qw/parse_date trim read_file/;
#eliminate leading and trailing whitespace;
my $trimmed = trim " XYZ "; # $trimmed is now "XYZ"
#inflate a DST date into a datetime object
my $dt = parse_date "20081231";
my $dt = parse_date "20081231", "235959";
#make reading files easier
read_file $filename;
read_file($filename, record_callback => sub{ ... });
EXPORTABLE SUBROUTINES
trim $string
Simple trim function to delete leading and trailing whitespace from a string.
parse_date $date, $time
Inflate a date in YYYYMMDD and time in HHMMSS format to a DateTime object. The time argument is optional.
read_file $filename, @parser_args
Will determine the file type based on the header record and instantiate and return the correct Finance::DST::FAN::Mail::File::* object for the filename provided.
file_info_from_remote_filename $remote_name
- company_code - The SystemID and Management Code (as described in Chapter 1, "Header Record") concatenated into a 5-character code.
- company_name - Legible version of the company name as provided by DST
- is_resend - 1 for resent file, 0 otherwise
- file_class - The type of file contained. The value matches the class name of the apropriate parser class. (FPR, SF, AMP, APR, DA, DFA, NAA, NFA)
- file_type - The natural-language code used internally by DST
- file_description - The more legible version of file_type.
file_info_from_header $header_record
Will return a hashref containing the following keys
- company_code - The SystemID and Management Code (as described in Chapter 1, "Header Record") concatenated into a 5-character code.
- company_name - Legible version of the company name as provided by DST
- processed_date - DateTime object of the file's processed date
- file_class - The type of file contained. The value matches the class name of the apropriate parser class. (FPR, SF, AMP, APR, DA, DFA, NAA, NFA)
- file_type - The natural-language code used internally by DST
- file_description - The more legible version of file_type.
- product_type - The kind of product contained (VUL, VA, MF, REIT, LP)
get_file_info $filename
Attempt to open the file, extract the header record and return the results of file_info_from_header
.
AUTHOR & LICENSE
Please see Finance::DST::FAN::Mail for more information.