$VERSION
=
do
{
my
@r
=(
q$Revision: 1.7 $
=~/\d+/g);
sprintf
"%d."
.
"%03d"
x
$#r
,
@r
};
use
base (
'Business::Shipping::Shipment'
);
new_with_init
=>
'new'
,
new_hash_init
=>
'hash_init'
;
shipper
=>
'USPS'
,
from_country
=>
'US'
,
);
sub
init
{
my
$self
=
shift
;
my
%values
= ( INSTANCE_DEFAULTS,
@_
);
$self
->hash_init(
%values
);
return
;
}
sub
from_country {
return
'US'
; }
sub
to_zip
{
my
$self
=
shift
;
if
(
$_
[ 0 ] ) {
my
$to_zip
=
shift
;
$to_zip
=~ /{\d,5}/
if
$to_zip
;
$self
->{
'to_zip'
} =
$to_zip
;
}
return
$self
->{
'to_zip'
};
}
sub
to_country
{
trace
'( '
. uneval( \
@_
) .
' )'
;
my
(
$self
,
$to_country
) =
@_
;
if
(
defined
$to_country
) {
$to_country
=
$self
->SUPER::to_country(
$to_country
);
my
$countries
=
$self
->config_to_hash(
cfg()->{ usps_information }->{ usps_country_name_translations }
);
$to_country
=
$countries
->{
$to_country
} ||
$to_country
;
debug3(
"setting to_country to \'$to_country\'"
);
$self
->{ to_country } =
$to_country
;
}
debug3(
"SUPER::to_country now is "
. (
$self
->SUPER::to_country() ||
''
) );
return
$self
->{ to_country };
}
1;