note
danb
Thanks a lot for the input, sauoq.
<blockquote><i>I guess it depends somewhat on your long term plans for this. If it were just this, I'd be inclined to use something a bit more descriptive. Like, Business::Shipping::Calculator or Business::Shipping::Cost or something.</i></blockquote>
<BR>
What if the same module were going to be doing a lot of other features as well? (Like the ones I mentioned <a ref="http://www.perlmonks.org/index.pl?node_id=262225">here</a>).<BR>
<BR>
The various features don't seem to lend themselves to a common designation, so even the vendors come up with vauge references to them: "UPS Online Web Tools" ("Online Web Tools!?", now *that* is vague). The problem is that they *do* easily lend themselves to common technical details (they all generate similar XML, etc.).
<blockquote><i>Well, honestly I didn't get far past the fact that even the POD didn't display cleanly in an 80 char wide terminal... In fact, the POD seems to be pretty well broken, at least for the Ship.pm file. So, I took a look, but not a very deep one.</i></blockquote>
Heh heh heh... I went to all the trouble to write the POD, then I forgot to even test it. :-)
<blockquote><i>I see you are trying to abstract out common things about packages in Business::Ship::Package and trying to include information about packages required by a specific shipper Business::Ship::<carrier>::Package. I wonder if it might not make more sense to just have a single package class which can hold all the information that might be required by a specific carrier. I certainly don't have a good overall picture of your design yet, but separating that stuff seems to be more complicated than necessary. Afterall, a package is a package is a package no matter who ships it.</i></blockquote>
Perhaps, I'll have mull over that for a little while. "Package" doesn't represent a physical package, really, but more of a "what does the carrier think of a package as?"<BR>
<BR>
Some carriers think that each package in a "shipment" should know the destination, origination, etc. (i.e. Packages are all treated as individual shipments). Other vendors think of a package as only one part of a larger shipment.<BR>
<blockquote><i>Ideally, this would be written so that if you wanted to add Airborne Express next week, you could just write a Business::Ship::Airborne::Rates module and drop it in. I'm not familiar enough with the problem space (it's probably pretty messy) to decide how easy or hard that would be. Just the same, that's what I'd strive for.</i></blockquote>
Yes, that's exactly what I'm striving for -- so I really appreciate your advice :-). I guess having the Package object is an additional piece of complexity.<BR>
<BR>
However, I think it's likely that each carrier will have a different expectation for "package" anyway (that has been my experience so far), so to add a new module, one would have to modify the Package handling anyway, and I think having their own derivitive of Business::Ship::Package would be better than having the same code be everything to everyone.<BR>
<blockquote><code>
use Business::Shipping;
# Query the module for installed shipper specific modules.
my @shippers = Business::Shipping::available_shippers();
my %shipping_option;
for my $shipper (@shippers) {
# Services would be Ground, 2nd day air, things like that.
my @services = $shipper->services();
for my $service (@services) {
# The $package would have been previously generated.
$shipping_option{$shipper->name}->{$service} =
$shipper->rate($service, $package);
}
}
</code></blockquote>
Great idea! Part of that feature (like "what services are available for xyz vendor?") are specifically supported by some vendors' XML API.<BR>
Again, I really appreciate the feedback.<BR>
<BR>
-Dan
262176
262192