Giter VIP home page Giter VIP logo

ledger-parser's Introduction

NAME
    Ledger::Parser - Parse Ledger journals

VERSION
    version 0.03

SYNOPSIS
     use 5.010;
     use Ledger::Parser;
     my $ledgerp = Ledger::Parser->new();

     # parse a file
     my $journal = $ledgerp->parse_file("$ENV{HOME}/money.dat");

     # parse a string
     $journal = $ledgerp->parse(<<EOF);
     ; -*- Mode: ledger -*-
     09/06 dinner
     Expenses:Food          $10.00
     Expenses:Tips        20000.00 IDR
     Assets:Cash:Wallet

     2011/09/07 opening balances
     Assets:Mutual Funds:Mandiri  10,305.1234 MFEQUITY_MANDIRI_IAS
     Equity:Opening Balances

     P 2011/08/01 MFEQUITY_MANDIRI_IAS 1,453.8500 IDR
     P 2011/08/31 MFEQUITY_MANDIRI_IAS 1,514.1800 IDR
     EOF

     # get the transactions
     my $txs = $journal->get_transactions;

     # get the postings of a transaction
     my $postings = $txs->[0]->get_postings;

     # get all the mentioned accounts
     my $accts = $journal->get_accounts;

DESCRIPTION
    This module parses Ledger journal into Perl document object. See
    http://ledger-cli.org/ for more on Ledger, the command-line double-entry
    accounting system software.

    This module uses Log::Any logging framework.

    This module uses Moo object system.

ATTRIBUTES
METHODS
  new()
    Create a new parser instance.

  $ledgerp->parse($str | $arrayref | $coderef | $filehandle) => $journal
    Parse ledger journal (which can be contained in a $str, an array of
    lines $arrayref, a subroutine which will be called for chunks until it
    returns undef, or a filehandle).

    Will die if there are parsing errors in journal.

    Returns Ledger::Journal object. The object will contain a series of
    Ledger::Transaction objects, which themselves will be comprised of a
    series of Ledger::Posting objects.

  $orgp->parse_file($filename) => $journal
    Just like parse(), but will load document from file instead.

FAQ
  Why? Ledger is already a command-line program. It even has 'lisp' output.
    I am not trying to reimplement/port Ledger to Perl. This module doesn't
    do reporting or parse expressions or many other Ledger features. I use
    this module mainly to insert/delete/edit transactions to journal file,
    e.g. for programatically reconciling journal with internet banking
    statement, or for shortcuts (see App::LedgerUtils for example).

AUTHOR
    Steven Haryanto <[email protected]>

COPYRIGHT AND LICENSE
    This software is copyright (c) 2011 by Steven Haryanto.

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.

ledger-parser's People

Contributors

sharyanto avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.