On Sun, 9 Nov 2003, Jonathan Swartz wrote: > Say I've got a function that takes a duration. I could > > 1) require the user to do DateTime::Duration->new(...); > 2) take a listref argument containing the params, e.g. [days=>1] and do the > creation myself > 3) be flexible and take either argument, distinguishing the two by isa() > > Any advice from others that have written APIs using durations?
DateTime.pm itself just has two methods in each case. So we have add(), which takes raw parameters, and add_duration() which takes an object. The former is very simply syntactic sugar for the the latter. -dave /*======================= House Absolute Consulting www.houseabsolute.com =======================*/