[Omaha.pm] SQL . sprintf

Jay Hannah jay at jays.net
Tue Aug 16 21:02:05 PDT 2005


On Aug 16, 2005, at 7:10 PM, Andy Lester wrote:
>>>        new Control::DateTime->format("%Y-%02d-%02d") . "'";
>>
>> Whoah... That *does* compile. new() is called, then format()... Scary.
>> I wouldn't actually use that if I were you. Just my $0.02.
>
> What are you basing that on?

Personal preference.

>   What do you imagine will go wrong?

My brain might explode. -grin-  You'd write this w/o hesitation:?

    new X->format()

If I felt compelled to do it all in one line these scare me less:

    X->new()->format()
    (X->new())->format()

Plus @ OSCON 2003 Damian Conway said "new X" is evil, and that 
"X->new()" is the way to go. Can't remember his reasons. Something 
about potential ambiguity in Perl 6 or something.

-shrug-   Just my $0.02 from the peanut gallery,

j



More information about the Omaha-pm mailing list