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_header $header_record
Will return a hashref containing the following keys
- 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)
- 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.