On Thu, 2 Sep 2004, Daisuke Maki wrote:

> +sub parse_datetime
> +{
> +    my $self = shift;
> +    if (!$self->{formatter} || ! UNIVERSAL::can($self->{formatter}, 
> 'parse_datetime')) {
> +        die "No formatter available (or specified formatter can't perform 
> 'parse_datetime()')";
> +    }
> +    $self->{formatter}->parse_datetime($_[0]);
> +}

Eek, this is evil.  You have an object method that is a constructor, but
the constructed object really has nothing to do with the object on which
you call the constructor.  How is this better than just calling
parse_datetime on the relevant DT::Format class or object?


I note that you didn't write any tests for it.  Maybe some part of you
secretly rebelled against its evilness.


-dave

/*=======================
House Absolute Consulting
www.houseabsolute.com
=======================*/

Reply via email to