[ic] Shipping Survey

Stefan Hornburg (Racke) racke at linuxia.de
Thu Oct 17 05:50:52 UTC 2013

On 10/16/2013 08:43 PM, William Carr wrote:
> On Oct 16, 2013, at 2:30 PM, Andrew Baerg <andrew.baerg at gmail.com> wrote:
>> On Wed, Oct 16, 2013 at 2:14 AM, Stefan Hornburg (Racke) <racke at linuxia.de> wrote:
>> In general, it would make sense to have a generic shipping ecosystem for
>> Perl + Interchange. But I'm sure there are a few things which can be discussed
>> resp. enhanced in Shipment, e.g.:
>> * use a better way to address the services instead of ->ups, ->...
>> I had actually not intended the Shipment module to be used directly. I have to confess that this is my first module published to CPAN. I had asked for help to get it published and this was one of the things that someone else did for me. There are definitely some areas where I could use some mentorship from a Perl guru to steer me in the right direction. :)
>> One of the main goals was to provide a consistent interface to the various shipping services so that you could do the following regardless of which service provider you were using:
>> my $shipment = Shipment::XYZ->new(
>>     from_address => Shipment::Address->new( ... ),
>>     to_address => Shipment::Address->new( ... ),
>>     packages => [ Shipment::Package->new( ... ), ],
>>   );
>> $shipment->ship('ground');
>> $shipment->get_package(0)->label->save;
> I'm glad this came up. I was just working on this today.
> What to we do when different carriers offer different services that will not fit into our predefined, generic services?

For different services your Shipment::XYZ can implement a method on top of what Shipment offers, let's say
fuel_surcharge, which is not implemented by Shipment::ABC.

In the generic code calculating the shipment price:

if ($shipment->can('fuel_surcharge')) {
    $shipping_cost += $shipment->fuel_surcharge;

Just an example.

> I think in the example above we will have to assume each carrier offers essentially the same services which may not be the case.
> In interchange we usually do something like:
> UserTag ship_cost
> blah, blah, bah
> shipping.asc:
> f [ship_cost mode=GROUND_HOME_DELIVERY]
> Today I messed around with an approach like so:
> shipping.asc:
> f [ship_cost carrier=FexEx service=ground]
> In my first example we have to assume each carrier's service (or mode) has a unique name of pass in a carrier parameter.
> In the later example we'd have to limit the generic services to the once provided by all the carriers used.

Shipment should define standard parameters for the constructor, Shipment::DEF can have additional parameters.


LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team

More information about the interchange-users mailing list