sub parse_file { my ($class, $file) = @_; local $/; open my $f, $file or croak $!; my $data = <$f>; return $class->parse($data); } =head2 parse Creates a C object from a string. =cut sub parse { my ($class, $data) = @_; my @lines = split /\n/, $data; my $type = shift @lines; croak "Can only handle bank accounts right now, not type $type" unless $type eq "!Type:Bank"; #### $ perl -MCarp=verbose qifread.pl at /usr/local/lib/perl5/site_perl/5.8.4/Finance/QIF.pm line 124 Finance::QIF::parse('Finance::QIF', '!Type:Bank\x{d}\x{a}D09/07/2004\x{d}\x{a}PDTE ENERGY PAYMENT\x{d}\x{a}MDTE ENERGY PAY...') called at /usr/local/lib/perl5/site_perl/5.8.4/Finance/QIF.pm line 111 Finance::QIF::parse_file('Finance::QIF', 'dfcu0904.qif') called at qifread.pl line 6