The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Finance::OFX::Parse::Simple - Parse a simple OFX file or scalar

VERSION

Version 0.06

SYNOPSIS

   use Finance::OFX::Parse::Simple;

   my $parser = Finance::OFX::Parse::Simple->new;

   my $data_from_file     = $parser->parse_file("myfile.ofx"); # returns a reference to a list of hash references

   my $data_from_scalar   = $parser->parse_scalar($ofx_data); 

METHODS

new

Create a new parser object.

parse_file

Takes a filename as an argument, slurps the file into memory, parses it and returns a reference to a list of hash references. Each hash reference contains two keys: 'account_id' which is the account number, and 'transactions' which is a reference to a list of hash references, each containing details for a single transaction.

Returns false if no filename was provided, the file is not a plain file, or the file is not openable.

parse_scalar

Takes a scalar as an argument containing OFX data. Returns a reference to a list of hash references. Each hash reference contains two keys: 'account_id' which is the account number, and 'transactions' which is a reference to a list of hash references, each containing details for a single transaction.

Returns false if no non-empty scalar is provided.

NOTES

The decimal point character (e.g. . or ,) can be configured before parsing OFX data so that it is handled correctly:

If the environment variable MON_DECIMAL_POINT exists then this is used as the decimal point separator. Failing that, the module will try to use the locale setting of the local system, through the POSIX module. As a last resort a . is used as the separator.

If you are working with OFX data from multiple sources, you can control the separator by setting the MON_DECIMAL_POINT environment variable before parsing each dataset, e.g.:

 $ENV{MON_DECIMAL_POINT} = '.';
 my $transactions_in_america = $parser->parse_file("bank-of-america.ofx");

 local $ENV{MON_DECIMAL_POINT} = ',';
 my $transactions_in_germany = $parser->parse_file("deutsche-bank.ofx");

AUTHOR

Jeremy Jones, <jjones at cpan.org>

BUGS

Please report bugs and feature requests to bug-finance-ofx-parse-simple at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Finance-OFX-Parse-Simple.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Finance::OFX::Parse::Simple

The latest version of this module is available on Github:

    http://github.com/JeremyJones/Finance--OFX--Parse--Simple

You can also look for information at:

COPYRIGHT & LICENSE

Copyright 2009-10 Jeremy Jones, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.