http://www.perlmonks.org?node_id=415789


in reply to Perl, Authorize.Net, and Broken Kneecaps

"That's one of the reasons I think the reports aren't that helpful, even though I could just attribute it to incompetence: if you can't easily see what they owe you, you can't easily request your money."

Never attribute to malice that which is adequately explained by human stupidity :)

That said, bravo -- excellent work. I have just one suggestion: Have you perhaps considered using a SQL database (nothing major -- maybe something as simple as SQLite) to manage things? Your script could read one report, and generate the rows as INSERT statements, then read the other report, and fill in the missing data with UPDATE statements.

Perl is great for parsing the incoming data (especially given its heterogeneous nature), but SQL servers shine at the data manipulation you're doing (specifically, the 'inversion' you're performing, plus grouping by date).

Remember: Perl is a very flexible tool, just like a Swiss Army knife. But if I'm turning a lot of screws, I'm not going to reach for my keychain, even if it does have a mini screwdriver; I'm going to use a "real" screwdriver. Sure, my "real" screwdriver doesn't do anything else, but it's way better suited to turning screws.

--Stevie-O
$"=$,,$_=q>|\p4<6 8p<M/_|<('=> .q>.<4-KI<l|2$<6%s!<qn#F<>;$, .=pack'N*',"@{[unpack'C*',$_] }"for split/</;$_=$,,y[A-Z a-z] {}cd;print lc

Replies are listed 'Best First'.
Re^2: Perl, Authorize.Net, and Broken Kneecaps
by brian_d_foy (Abbot) on Dec 17, 2004 at 22:09 UTC

    At some point when I have a lot of free time, I might consider downloading all the data and storing it in a database, but I'd need a lot of free time to want to do that. I wouldn't take a long time, it's just not that useful. Of all the things I could do with my time, making my own database for all of this doesn't get that high on my list. ;)

    I'm not going to need to do fancy selects. Most records have no relationship to other records, and it's very easy to pull up a single record. I already get summary reports about total charges, etc, so I don't need that. Authorize.Net has the basic stuff covered. I just needed something a little different this time. If I did this in DBI, I would have taken a lot more time and had to write a lot more code. There's not a big gain there.

    The interesting stuff is already in my subscriber database. That's where I can do nifty things, should I get the time. That is a relational database. :)

    And I'm not attributing anything to malice: it's greed. :)

    --
    brian d foy <bdfoy@cpan.org>