App-HomeBank2Ledger

 view release on metacpan or  search on metacpan

lib/App/HomeBank2Ledger/Ledger.pm  view on Meta::CPAN

package App::HomeBank2Ledger::Ledger;
# ABSTRACT: Ledger data representation


use warnings;
use strict;

our $VERSION = '0.010'; # VERSION


sub new {
    my $class = shift;
    my %args  = @_;
    return bless {%args}, $class;
}


sub accounts     { shift->{accounts}     || [] }
sub commodities  { shift->{commodities}  || [] }
sub payees       { shift->{payees}       || [] }
sub tags         { shift->{tags}         || [] }
sub transactions { shift->{transactions} || [] }


# TODO - These should validate incoming data.

sub add_accounts {
    my $self = shift;
    push @{$self->{accounts}}, @_;
}

sub add_commodities {
    my $self = shift;
    push @{$self->{commodities}}, @_;
}

sub add_payees {
    my $self = shift;
    push @{$self->{payees}}, @_;
}

sub add_tags {
    my $self = shift;
    push @{$self->{tags}}, @_;
}

sub add_transactions {
    my $self = shift;
    push @{$self->{transactions}}, @_;
}

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

App::HomeBank2Ledger::Ledger - Ledger data representation

=head1 VERSION

version 0.010

=head1 SYNOPSIS

    my $ledger = App::HomeBank2Ledger::Ledger->new;

    $ledger->add_payees("Ann's Antiques", "Missy Automative");

    for my $payee (@{$ledger->payees}) {
        print "Payee: $payee\n";
    }

=head1 DESCRIPTION

This class provides a unified in-memory representation of a ledger, including associated metadata.

Here is a specification for the substructures:

=head2 account



( run in 1.288 second using v1.01-cache-2.11-cpan-39bf76dae61 )