resurect from the dead

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4992 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 2001-07-25 03:04:40 +00:00
parent 87a8e216c9
commit f01c9af127

View File

@ -0,0 +1,28 @@
#!/usr/bin/perl -w
# gnucash perl demo:
#
# This file demonstrates how to open an acount file and print
# the names and balances of the top-level accounts in the file.
#
# use lib '../swig/perl5/';
use lib '../perl5/';
use gnucash;
package gnucash;
die "Usage: $0 <filename>" if $#ARGV < 0;
print "its $ARGV[0]\n";
$sess = gnucash::xaccMallocSession ();
$grp = gnucash::xaccSessionBeginFile ($sess,$ARGV[0]);
$numacc = gnucash::xaccGroupGetNumAccounts ($grp);
print "Loaded $numacc accounts\n\n";
for ($i=0; $i<$numacc; $i++) {
$acct = gnucash::xaccGroupGetAccount ($grp, $i);
$acctname = gnucash::xaccAccountGetName ($acct);
$baln = gnucash::xaccAccountGetBalance ($acct);
print "\tAccount: $acctname \tBalance: $baln\n";
}
gnucash::xaccSessionEnd ($sess);