CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Re: [Zhris] Postage cost calculation: Edit Log



Zhris
Enthusiast

Jun 10, 2011, 3:43 PM


Views: 4390
Re: [Zhris] Postage cost calculation

Hi Miller,

Thanks very much for all your effort. I've looked through your code and I like the improvements that you have made.

The new data format is much nicer. As this function will become part of a few other existing functions, I had originally wanted to keep the data in the same format as those. Since no one would ever need to read the data in its raw format, I didn't feel it was neccessary to make it readable. But I much prefer your way, as you say, it makes sense.

I did originally use ranges i.e. "1-200, 201-400, 401-600" instead of a "length", but this would mean having to use a whole other level of error checking i.e. check the right side is higher than the left side etc (me attempting to be efficient). I would very much like to go back to ranges.

I haven't delved enough into regular expressions yet, so thank you for explaining how to not capture a particular group. I never knew it was possible.

By the way, did you mean (never come across the // op)?:

Code
my $multiplier             = $6 // 1; 
my $multiplier = $6 || 1;


At this time, the rates are fairly basic:

UK = free all the time.
Europe = See http://www.royalmail.com/portal/rm/content1?mediaId=53800712&catId=400036 (top)
Rest of the world = See http://www.royalmail.com/portal/rm/content1?mediaId=53800712&catId=400036 (bottom)

"Cost operations" allow me to most importantly make delivery free after a certain weight i.e. Europe over 10000g will be 0.00.

The most important part, which I hadn't yet got round to doing is what I explained previously, since the maximum weight for i.e. Europe is 2000g, I would need the rates to "repeat" so that i.e. order = 3000g (above the max), first package = 2000g, second package = 1000g. I planned on doing this with some kind of $weightoffset, which will restart while appending to the existing $totalcost after i.e. 2000g. I hope I have explained this properly.

Anyhow, I will continue work on your refined function tomorrow. And I would massively appreciate any help or advice as you have done so already, its very helpful to see how others refine what i've done.

Thanks once again,

Chris


(This post was edited by Zhris on Jun 10, 2011, 4:25 PM)


Edit Log:
Post edited by Zhris (Enthusiast) on Jun 10, 2011, 3:45 PM
Post edited by Zhris (Enthusiast) on Jun 10, 2011, 3:53 PM
Post edited by Zhris (Enthusiast) on Jun 10, 2011, 3:54 PM
Post edited by Zhris (Enthusiast) on Jun 10, 2011, 3:54 PM
Post edited by Zhris (Enthusiast) on Jun 10, 2011, 3:56 PM
Post edited by Zhris (Enthusiast) on Jun 10, 2011, 4:25 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives