Finance-Bank-SentinelBenefits-Csv401kConverter

 view release on metacpan or  search on metacpan

lib/Finance/Bank/SentinelBenefits/Csv401kConverter/QifWriter.pm  view on Meta::CPAN

package Finance::Bank::SentinelBenefits::Csv401kConverter::QifWriter;
$Finance::Bank::SentinelBenefits::Csv401kConverter::QifWriter::VERSION = '1.3';
use Modern::Perl '2015';
use feature 'signatures';

=head1 NAME

Finance::Bank::SentinelBenefits::Csv401kConverter::QifWriter -
Takes C<Finance::Bank::SentinelBenefits::Csv401kConverter::Line> objects
and writes them out to a QIF file

=head1 VERSION

version 1.3

=head1 SYNOPSIS

This class is responsible for taking a set of Lines and writing them out
to QIF format.  We use the class C<Finance::QIF> to do the acutal writing to disk.  If you pass it a secondary set of account information, it will also take any company matches, reverse their values, and write them to a secondary file.  This is to al...

=cut 

use Moose;

use Finance::QIF;
use Finance::Bank::SentinelBenefits::Csv401kConverter::Line;

=head1 Constructor

=head2 new()

    my $l = Finance::Bank::SentinelBenefits::Csv401kConverter::QifWrite->new( {
    main_output_filename => $main_output_filename,
    flip_output_filename => $flip_output_filename, ( optional )
    account           => $account,
    trade_date        => $trade_date,
    } );

  Constructs a new QifWriter for the given trade date and account.  Each qif writer can only generate to one trade date and account, and one main file.

=cut 

####
# BUILDARGS initializes the QIF reader based on the passed in filename
####
around BUILDARGS => sub {
      my $orig = shift;
      my $class = shift;

      my $hashref = $class->$orig(@_);

      if(exists $hashref->{output_file}){
	  my $qif_output = Finance::QIF->new( file => $hashref->{output_file} );

	  $hashref->{qif_output} = $qif_output;
      }

      return $hashref;
};


=head2 BUILD



( run in 0.714 second using v1.01-cache-2.11-cpan-d80b1682f3f )