File::HomeBank - Parse HomeBank files
version 0.008
# Functional: use File::HomeBank qw(parse_file); my $raw_data = parse_file('path/to/homebank.xhb'); # Or OOP: my $homebank = File::HomeBank->new(file => 'path/to/homebank.xhb'); for my $account (@{$homebank->accounts}) { print "Found account named $account->{name}\n"; }
This module parses HomeBank files.
Get the filepath (if parsed from a file).
$homebank = File::HomeBank->new(string => $str); $homebank = File::HomeBank->new(file => $filepath);
Construct a File::HomeBank.
$version = $homebank->file_version;
Get the file format version.
$title = $homebank->title;
Get the title or owner property.
$base_currency = $homebank->base_currency;
Get the key of the base currency.
Get an arrayref of accounts.
Get an arrayref of categories.
Get an arrayref of currencies.
Get an arrayref of payees.
Get an arrayref of tags.
Get an arrayref of transactions.
$account = $homebank->find_account_by_key($key);
Find an account with the given key.
$currency = $homebank->find_currency_by_key($key);
Find a currency with the given key.
$category = $homebank->find_category_by_key($key);
Find a category with the given key.
$payee = $homebank->find_payee_by_key($key);
Find a payee with the given key.
@transactions = $homebank->find_transactions_by_transfer_key($key);
Find all transactions that share the same transfer key.
$other_transaction = $homebank->find_transaction_transfer_pair($transaction);
Given a transaction hashref, return its corresponding transaction if it is an internal transfer. If the transaction is an internal transaction with a destination account but is orphaned (has no matching transfer key), this also looks for another orphaned transaction in the destination account that it can call its partner.
Returns undef or empty if no corresponding transaction is found.
$transations = $homebank->sorted_transactions;
Get an arrayref of transactions sorted by date (oldest first).
$category_name = $homebank->full_category_name($key);
Generate the full name for a category, taking category inheritance into consideration.
Income Salary <--
will become:
"Income:Salary"
$formatted_amount = $homebank->format_amount($amount); $formatted_amount = $homebank->format_amount($amount, $currency);
Formats an amount in either the base currency (for the whole file) or in the given currency. Currency can be a key or the actualy currency structure.
$homebank_data = parse_file($filepath);
Read and parse a HomeBank .xhb file from a filesystem.
$homebank_data = parse_string($str);
Parse a HomeBank file from a string.
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.
Charles McGarvey <chazmcgarvey@brokenzipper.com>
This software is Copyright (c) 2019 by Charles McGarvey.
This is free software, licensed under:
The MIT (X11) License
To install App::HomeBank2Ledger, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::HomeBank2Ledger
CPAN shell
perl -MCPAN -e shell install App::HomeBank2Ledger
For more information on module installation, please visit the detailed CPAN module installation guide.