Finance::Account::Archive - Storage of account balances


NAME

Finance::Account::Archive - Storage of account balances


SYNOPSIS

  use Finance::Account::Archive;
  $archive = Finance::Account::Archive->new;
  $archive->display_all_entries;
  $archive->add_entry(name => "Checking", balance => 789.12);
  @entries = $archive->get_entries(name => "Savings");
  $archive->run;


DESCRIPTION

This module is for storing bank account information in a database. This information consists of an account name, a balance, and a date.

new(... parameters ...)

Creates a new archive (database), or connects to the existing one. The valid parameters, which are passed as a hash, are:

driver

The database driver, which defaults to "Pg", for PostgreSQL. MySQL ("mysql") has also been successfully used. See DBI for supported drivers.

username

The user name for connecting to the database. This defaults to "root" if the driver is "mysql", or an empty string otherwise.

password

The password for connecting to the database. This defaults to an empty string.

dbname

The name of the database, which defaults to "finances".

disconnect

Disconnects from the database, which is done automatically when the Finance::Account::Archive instance is destroyed.

create_database

Creates the database and adds the "entry" table.

Creates the database and adds the "entry" table.

has_entry(name => $name, date => $date)

Returns whether an entry exists for the given name and date. If the date is not given, the current date is used.

add_entry(name => $name, balance => $balance, date => $date)

Adds the given entry, if an existing one for the name and date does not exist.

delete_entry(name => $name, balance => $balance, date => $date)

Deletes the given entry, if it exists. balance and date are used only if they are defined.

update_entry(... parameters ...)

Updates the given entry, if it exists. The valid parameters, passed as a hash:

name

The current name of the existing entry.

balance

The current balance of the existing entry.

date

The date of the existing entry. If not defined, it is assumed to refer to the current date.

newname

The new name of the entry.

newbalance

The new balance of the entry.

display_all_entries

Dumps the entire entry table, formatted.

destroy_database

Removes the database.

get_entries(... parameters ...)

Queries for entries, using the following parameters:

name

The account name.

order

The order in which to return the entries found.

limit

The maximum number of entries to return.

lowerbound

The earliest date to query.

upperbound

The latest date to query.

run

Interactively runs against the database, allowing the user to add, modify and delete data, and to add an account name.

Class Variables

verbose

Setting this to a non-zero value results in debugging output.


CAVEATS

(Verbatim from Finance::Bank::LloydsTSB) This is code for online banking, and that means your money, and that means BE CAREFUL. You are encouraged, nay, expected, to audit the source of this module yourself to reassure yourself that I am not doing anything untoward with your banking data. This software is useful to me, but is provided under NO GUARANTEE, explicit or implied.


AUTHOR

Jeff Pace jpace@cpan.org


COPYRIGHT AND LICENSE

Copyright 2005 by Jeff Pace.

This library is free software; you may redistribute it and/or modify it under the same terms as Perl itself.