in reply to Re: Tangram
in thread Tangram

Let me see if I got this straight...

Suppose I have an online store where I sell goods to several different countries each using its own currency. I could say (for Brazil's case):
my $real = new Currency; $real->name('Real'); $real->country('BR'); $real->dolarValue(1.81);
And repeat this as many times necessary for each country. Then use set everything up, and use DBI to get the items from a shopping cart as usual (name, price, other attributes). Then my app would work as if my currency variables had been declared at startup, so I wouldn't have to do a 'select' myself to find out what the price of an item was in Reals?

That's a bit confusing... Let me try this instead.
Instead of doing two selects (one for the product, and one for the currency), I could have the currency loaded as an object and do my select on the product as if the currency information had always been there?

#!/home/bbq/bin/perl
# Trust no1!

Replies are listed 'Best First'.
RE: RE: Re: Tangram
by btrott (Parson) on May 16, 2000 at 22:18 UTC
    Well... I'm not sure I know quite what you mean. In your example, you could create all of those Currency objects, then use Tangram to insert them into a database. That would be one script.

    Then, in another script, you could tell Tangram to go and get you a particular Currency object. It would load the data from the database and hand you back a Currency object, just like the one you had created in the first script.

    You're not actually eliminating select statements, because *someone* still has to do a select--even if it's not you, it's Tangram. :) But you don't have to worry about that select; you can just act as if you had created the Currency object in the same script.

    Does that make sense?

    There's a good introduction to using Tangram in WebTechniques.