From: R P. <arc...@mt...> - 2006-11-14 17:04:23
|
On Monday 13 November 2006 2:34 pm, Tony Fraser wrote: > On Mon, 2006-11-13 at 14:32 -0500, C. Duncan Hudson wrote: > > I have several shell scripts that load invoices & pos, and which > > print > > pick lists. I'm in the process of moving them all to > > LWP::UserAgent. > > The way I see it I'm safer with LWP then I am with the API - the API > > requirements are far more likely to change then the screens are. > > Even > > if the screens do change then it's pretty straight forward updating > > the > > Perl script. Also, I agree that it's better to not have to shell to > > call the API as that's just another point of failure. It's also > > difficult to determine whether the API call actually worked or not. > > I > > think there was some talk, along time ago, about a Perl module for > > SQL-Ledger, but that would get outdated in no time. LWP, in my > > opinion, > > is a better fit. > > I agree with your LWP opinion. The API and the HTML forms are basically > the same. All the API is is a way to supply the CGI scripts a query > string as a command line parameter. I also think that scripts that use > LWP (or any HTTP library) are more flexible, all they need is HTTP > access to you SQL Ledger installation. They don't need to run locally on > the SQL Ledger server. > > Some time ago I wrote this proof of concept code: > http://openledger.sourceforge.net/SL-Api.tar.gz > > Basically, it provides a simple to understand PERL API by automating the > SQL Ledger web interface with LWP anf HTML::Form in the background. As > it was only a proposal and no one showed any interest in it at the time > it only works with the GL. Adding more modules shouldn't be a big deal > though. When I had to repost a bunch of invoices to solve a COGS out of order problem, I used WWW:Mechanize which wraps up functionality found in LWP. Works with HTTPS too. Nice and simple..... goto page... fill form..submit form....... :) http://cpanratings.perl.org/dist/WWW-Mechanize http://search.cpan.org/~petdance/WWW-Mechanize/ Cheers ! Roy |