Skip Menu |

This queue is for tickets about the p5-Finance-OFX CPAN distribution.

Report information
The Basics
Id: 49945
Status: resolved
Priority: 0/
Queue: p5-Finance-OFX

People
Owner: Nobody in particular
Requestors: mooredan [...] suncup.net
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: Parser not recognizing break between header and content (Fidelity OFX)
I am processing an OFX response from Fidelity with my $tree = Finance::OFX::Parse::parse($ofxContent); and am getting this message from the module: Use of uninitialized value in subroutine entry at /usr/local/share/perl/5.10.0/Finance/OFX/Tree.pm line 57. Use of uninitialized value in string eq at /usr/local/share/perl/5.10.0/Finance/OFX/Parse.pm line 112. I have debugged the issue and have found that the problem stems from a space on the line that separates the header from the content (newlines shown with $ character) ... OLDFILEUID:NONE$ NEWFILEUID:D4EC1DC4-42F8-4686-849E-E3F5A6973A4E$ $ <OFX><SIGNONMSGSRSV1><SONRS>$ ... and this line in Parse.pm is not splitting the data into the header and content in this case. my ($header, $body) = split /\n\n/, shift, 2; I couldn't find in the OFX spec if there were any restrictions on this "blank" line which separates the data, but it certainly appears that this should be Fidelity's problem to solve (I'll probably have less luck getting them to correct this issue) (As a side note, Microsoft Money interprepts this data sucessfully). I have verified that this modification resolves the issue: my ($header, $body) = split /\n[\ \t]*\n/, shift, 2; Dan
On Wed Sep 23 09:45:49 2009, mooredan wrote: Show quoted text
> I have verified that this modification resolves the issue: > > my ($header, $body) = split /\n[\ \t]*\n/, shift, 2;
I had a similar issue with OFX generated by ShareBuilder. What helped there was to move the "Un-networkify newlines" regex before that split that you mentioned, i.e. this at the top of the subroutine: $_[0] =~ s/\x0D//g; -Steve
Subject: finance_ofx_parse_newlines.patch
--- Parse.pm.orig 2010-10-13 17:05:29.000000000 -0400 +++ Parse.pm 2010-10-13 17:06:33.000000000 -0400 @@ -97,17 +97,16 @@ sub parse_dates sub parse { + $_[0] =~ s/\x0D//g; # Un-networkify newlines + my ($header, $body) = split /\n\n/, shift, 2; # Parse the OFX header block $header =~ s/^\s//; # Strip leading whitespace - $header =~ s/\x0D//g; # Un-networkify newlines my %header = split /[:\n]/, $header; # Convert to a hash return undef unless ($header{OFXHEADER} == '100') and ($header{DATA} eq 'OFXSGML'); -# $body =~ s/\x0D//g; # Un-networkify newlines - my $tree = Finance::OFX::Tree::parse($body); return undef unless $tree and ($tree->[0]{name} eq 'ofx');
I don't have time to fix this right now. Feel free to fork the project on GitHub (https://github.com/bfoz/p5-Finance-OFX), make the changes, and then send me a pull request.
On Fri Dec 10 20:20:41 2010, BFOZ wrote: Show quoted text
> I don't have time to fix this right now. Feel free to fork the project > on GitHub > (https://github.com/bfoz/p5-Finance-OFX), make the changes, and then > send me a pull > request.
Pull request sent. Fork is at: https://github.com/horsepunchkid/p5-Finance-OFX -Steve
On Thu Sep 01 09:26:15 2011, SSEVERIN wrote: Show quoted text
> Pull request sent. Fork is at: > > https://github.com/horsepunchkid/p5-Finance-OFX
Merged. Thanks.