Subject: | Bug in UPS_Offline-update-fuel-surcharge.pl |
Date: | Mon, 4 Aug 2008 13:27:12 -0500 |
To: | bug-business-shipping [...] rt.cpan.org |
From: | Josh Lavin <josh [...] perusion.com> |
Using latest Business-Shipping-2.03.
Perl 5.8.8
It appears the UPS website alternates between using a space and a non-
breaking space in some of the text that the UPS_Offline-update-fuel-
surcharge.pl script grabs.
Running the script returned:
Can't use an undefined value as a HASH reference at - line 131.
I modified the regex and the script works correctly. Here's a diff:
--- Business-Shipping-UPS_Offline-update-fuel-surcharge.pl.orig
2005-12-31 23:35:26.000000000 -0500
+++ Business-Shipping-UPS_Offline-update-fuel-surcharge.pl 2008-08-04
14:20:45.000000000 -0400
@@ -89,8 +89,8 @@
my $rates = { ground => {}, air => {} };
my %type_regex = (
#'ground' => '^<STRONG>Ground<BR></STRONG>Through (\w+) (\d
+), (\d+): (\d+\.?\d?\d?)%',
- 'ground' => '^<STRONG>Ground<BR></STRONG>Through (\w+) (\d+),
(\d+): (\d+\.?\d?\d?)%<BR>Effective (\w+) (\d+), (\d+): (\d+\.?\d?\d?)
%',
- 'air' => '^<STRONG>Air and International<BR></
Show quoted text
STRONG>Through (\w+) (\d+), (\d+): (\d+\.?\d?\d?)%<BR>Effective (\w+)
(\d+), (\d+): (\d+\.?\d?\d?)%',
+ 'ground' => '^<STRONG>Ground<BR></STRONG>Through(?:\s| )
(\w+) (\d+), (\d+): (\d+\.?\d?\d?)%<BR>Effective(?:\s| )(\w+) (\d
+), (\d+): (\d+\.?\d?\d?)%',
+ 'air' => '^<STRONG>Air and International<BR></
Show quoted textSTRONG>Through(?:\s| )(\w+) (\d+), (\d+): (\d+\.?\d?\d?)
%<BR>Effective(?:\s| )(\w+) (\d+), (\d+): (\d+\.?\d?\d?)%',
);
#print "content = $content\n";
Thanks,
Josh
--
Josh Lavin
Perusion -- Expert Interchange Consulting http://www.perusion.com/
phone 210-764-0431 tollfree 800-949-1889