modernize

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4993 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 2001-07-25 03:21:13 +00:00
parent f01c9af127
commit 84c3a5d938

View File

@ -6,15 +6,18 @@
# the names and balances of the top-level accounts in the file. # the names and balances of the top-level accounts in the file.
# #
# use lib '../swig/perl5/'; # use lib '../swig/perl5/';
use lib '../perl5/'; use lib '..';
use gnucash; use gnucash;
package gnucash; package gnucash;
die "Usage: $0 <filename>" if $#ARGV < 0; die "Usage: $0 <filename>" if $#ARGV < 0;
print "its $ARGV[0]\n"; print "its $ARGV[0]\n";
$sess = gnucash::xaccMallocSession (); $session = gnucash::gnc_book_new ();
$grp = gnucash::xaccSessionBeginFile ($sess,$ARGV[0]); gnucash::gnc_book_begin ($session, $ARGV[0], 0, 0);
gnucash::gnc_book_load ($session);
$grp = gnucash::gnc_book_get_group ($session);
$numacc = gnucash::xaccGroupGetNumAccounts ($grp); $numacc = gnucash::xaccGroupGetNumAccounts ($grp);
print "Loaded $numacc accounts\n\n"; print "Loaded $numacc accounts\n\n";
@ -25,4 +28,4 @@ for ($i=0; $i<$numacc; $i++) {
print "\tAccount: $acctname \tBalance: $baln\n"; print "\tAccount: $acctname \tBalance: $baln\n";
} }
gnucash::xaccSessionEnd ($sess); gnucash::gnc_book_end ($session);