NAME

App::HomeBank2Ledger::Ledger - Ledger data representation

VERSION

version 0.002

SYNOPSIS

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

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

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

DESCRIPTION

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

Here is a specification for the substructures:

account

This is a fully-qualified account name. Names may contain colons for representing a hierarchy of accounts. Examples:

  • "Assets:Bank:Chase1234"

  • "Liabilities:Credit Card:CapitalOne"

commodity

This is a hashref like this:

{
    symbol  => '$',             # required
    iso     => 'USD',           # optional
    name    => 'US Dollar',     # optional
    format  => '$1000.00',      # optional
}

payee

This is just a string with the name of a "payee" or memo/description/narration.

tag

This is just a string with the text of a tag.

transaction

This is a hashref like this:

{
    date        => '2019-06-12',        # required
    payee       => 'Malcolm Reynolds',  # required
    status      => 'cleared',           # optional; can be "cleared" or "pending"
    memo        => 'Medical supplies',  # optional
    postings    => [                    # required
        {
            account     => 'Some Account',  # required
            amount      => '16.25',         # required for at least n-1 postings
            commodity   => {
                symbol  => '$',
                format  => '$1,000.00',
                iso     => 'USD',
                name    => 'US Dollar',
                syprf   => 1,
                dchar   => '.',
                gchar   => ',',
                frac    => 2,
            },
            payee       => 'Somebody',      # optional
            memo        => 'Whatever',      # optional
            status      => 'pending',       # optional; can be "cleared" or "pending"
            tags        => [qw(niska train-job)],
        },
        ...
    ],
}

ATTRIBUTES

accounts

Get an arrayref of accounts.

commodities

Get an arrayref of commodities.

payees

Get an arrayref of payees.

tags

Get an arrayref of tags.

transactions

Get an arrayref of transactions.

METHODS

new

$ledger = App::HomeBank2Ledger::Ledger->new(%ledger_data);

Construct a new ledger instance.

add_accounts

Add accounts.

add_commodities

Add commodities.

add_payees

Add payees.

add_tags

Add tags.

add_transactions

Add transactions.

BUGS

Please report any bugs or feature requests on the bugtracker website https://github.com/chazmcgarvey/homebank2ledger/issues

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR

Charles McGarvey <chazmcgarvey@brokenzipper.com>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2019 by Charles McGarvey.

This is free software, licensed under:

The MIT (X11) License