On Fri, Jul 26, 2013 at 4:45 AM, Perl Beginners <beginners@perl.org> wrote:

> On 07/25/2013 04:40 PM, Charles DeRykus wrote:
>
>>
>>
>>
>> On Wed, Jul 24, 2013 at 10:56 PM, Michael Brader <
>> mbra...@internode.com.au 
>> <mailto:mbra...@internode.com.**au<mbra...@internode.com.au>>>
>> wrote:
>>
>>
>>     On 07/25/2013 10:14 AM, mimic...@gmail.com
>>     <mailto:mimic...@gmail.com> wrote:
>>
>>>     I was trying to use Date::Simple to convert date from DD-MM-YYYY
>>>     to ISO standard YYYY-MM-DD,  but it produced error below because
>>>     it returned undef when the date passed is not ISO standard.
>>>
>>
>>     Yeah on quick scan of the perldoc it looks like Date::Simple
>>     doesn't offer much in the way of parsing.
>>
>>      [...]
>>>
>>>     Most of the date modules on CPAN cannot do the job for me. I
>>>
>>
>> Date::Manip and friends are wonderfully versatile but with even in this
>> simple case, it does start to get a bit twisty with special parse and
>> output methods:
>>
>> IMO, it'd be superb if the earlier functional interface or even
>> parse_date  in Date::Manip::Date would just accept a hash ref of
>> non-standard  format specs.  Then, you could just output with UnixDate as
>> usual.
>>
>>
>>      eg,  ParseDate( ... ,   { fmt1="%d-%m-%Y", fmt2=... } )
>>
>

>  Perhaps I'm missing something... but why do you want a hash ref?  Why not
> just a list (or listref) of formats. I'm not sure what the keys 'fmt1',
> 'fmt2', play in your suggestion (and if they don't play any role, a listref
> would definitely be better).
>
> So, if I understand your suggestion, what you want is this:
>
>    $date->parse( $string, $listref, @opts );
>
> where $listref is optional, but if included, it would be a list of
> formats(similar to parse_format) thatthe date would be parsed against.  If
> they all failed, it could then fall back on the standard formats. If
> $listref were omitted, only the standard formats would be used.
>
> Does this sound like what you're suggesting?
>
>
Yes  the listref would be another simpler way.  I can't see
any value for the hashref unless someone had a need for a
shortcut identifier for the actual format.

-- 
Charles DeRykus

Reply via email to