[ic] I've been writing an Interface to SQL-Ledger Accounting...

Mike Heins interchange-users@interchange.redhat.com
Mon May 6 23:38:00 2002


Quoting Daniel (danht@callthenet.com):
> Hello List.
> 
> First of all thanks to Mike H., Red Hat, and all the Interchange
> contributors for putting together a great product.
> 
> I'm new to perl and Interchange but not to systems integration projects. -
> So please bear with me.
> 
> First a little Background: "SQL-Ledger Accounting "www.sql-ledger.org" is a
> multi-user, double entry, accounting system written in Perl and is licensed
> under the GNU General Public License."
> 
> The SQL-Ledger API: "SQL-Ledger functions can be accessed from the command
> line by passing all the variables in one long string to the perl script. The
> variable=value pairs must be separated by an ampersand. See
> "www.sql-ledger.org/misc/api.html" for more details on the command line
> interface." (You can also do the same thing via HTTP as apposed to the
> command line.)
> 
> What I have done on this project so far, sans some of the dirty details...
> 
> In order for me to interface interchange with sql-ledger I needed to have
> sql-ledger assign a unique customer id to each interchange user. Also I need
> a mechanism to save/update sql-ledger's customer information whenever an
> interchange user creates or update his account.
> 
> My solution to handle this was to create a perl module called
> Vend::SLInterface. It contains several routines that encapsulate the
> interface to sql-ledger. The current version uses back ticks to call the
> local install of sql-ledger. However, future versions will allow calling
> sql-ledger using http also.
> 
> Here is where I need some guidance...
> 
> You see in my first attack at this problem I hacked the UserDB.pm
> "assign_username" and "set_values" routines directly. Basically adding a
> call to my Vend::SLInterface module just before each routine returns
> (successfully) a value.

Hmm. It would be better to use the overriding method instead of hacking
the module. You should be able to search for "override" on the web
site (untested) and find the reference.

As I see, reading farther, you know about this.

> 
> Works so far so good...
> 
> Now I'm trying to use a custom order route that calls my Vend::SLInterface
> module to save my orders into sql-ledger but ran right into Safe. -Ouch.
> That hurt!
> 
> But, I also know that Safe is my friend and I don't want to open up any
> holes as I put this thing together.
> 
> As I've researched issues regarding [realperl], User tags, Global Subs,
> etc...
> 
> I'm now asking myself should I be doing this differently?...
> 
> Should I be hacking UserDB.pm directly or overriding the routines with a
> Global Sub?...
> 
> Can a Global Sub that is overriding "set_values" in UserDB.pm call the
> "real" "set_values" routine prior to running its own code?...

Probably not. But it might make more sense to provide your own
Vend::UserDB::userdb function which preps everything and calls
your own custom routines based on function.

-- 
3005 Nichols Rd., Hamilton, OH  45013
phone +1.513.523.7621      <mike@valuemedia.com>

People who want to share their religious views with you
almost never want you to share yours with them. -- Dave Barry