NAME

Finance::Pershing::StandardFiles::Utils - Utilities for interacting with Pershing Standard Files

SYNOPSIS

use Finance::Pershing::StandardFiles::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::Pershing::StandardFile::* object for the filename provided.

file_info_from_header $header_record

Will return a hashref containing the following keys

remote_id
run_date - DateTime object of the file's run date and time
data_date - DateTime object of the file's data date
file_class - The type of file contained. The value matches the class name of the apropriate parser class. (ACCT, SPAT, IMSF)
file_type - The natural-language code used internally by Pershing

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::Pershing::StandardFile for more information.