On Fri, Sep 02, 2011 at 11:38:29AM +0100, Nicholas Clark wrote: > Am I right in thinking that the information strptime() wants to return is > > a) the values of what it parsed > b) what things it could parse (zero or more from seconds, minutes, hours, etc) > c) where in the string the parse failed > > ? > > The problems being that strptime() in Time::Piece only tells you (a), > and has no way of telling you (b) or (c)? Yes; entirely. My proposed alternatives of my @t = localtime() strptime $fmt, $str, \@t or my @t = strptime $fmt, $str, localtime() would signal b) by virtue of not altering (in the ARRAYref case), or returning passthrough (in the function case) the fields that were unaltered. The signal for c) is a little more complex - I pondered abusing the pos() marker on it, a.la. http://search.cpan.org/~pevans/Term-TermKey-0.10/lib/Term/TermKey.pm#$key_=_$tk->parse_key_at_pos(_$str,_$format_) though I admit I don't yet have a complete specification on this regard. -- Paul "LeoNerd" Evans leonerd@leonerd.org.uk ICQ# 4135350 | Registered Linux# 179460 http://www.leonerd.org.uk/Thread Previous | Thread Next